1 2 Previous Next 25 Replies Latest reply on Sep 20, 2014 12:11 PM by Nehme

    Detecting Operating System Path

    Nehme

      Hello,

       

      Can filemaker detect operating system path?

      This includes in Windows:

      - Windows folder path

      - System or system 32 path

       

      In Mac: operating system folder path

       

      As I know, system and system 32 folder changes between different windows versions.

      And operating system might be installed on different drivers.

      Can Filemaker 13 Pro Advanced detect those path (such as Desktop or Document path)?

       

      Thank you for the help.

        • 1. Re: Detecting Operating System Path
          Stephen Huston

          If you check out the Get(functions) in the calc engine, you will find:

          • Get ( DesktopPath )
          • Get ( DocumentsPath )
          • Get ( DocumentsPathListing )
          • Get ( FileMakerPath )
          • Get ( PreferencesPath )
          • Get ( SystemDrive )
          • Get ( SystemIPAddress )
          • Get ( SystemLanguage )
          • Get ( SystemNICAddress )
          • Get ( SystemPlatform )
          • Get ( SystemVersion )
          • Get ( TemporaryPath )

          What do you need to do with the System Path?

          • 2. Re: Detecting Operating System Path
            beverly

            These paths may depend upon the LOGGED IN user and may be different. Is the OP asking for a central location regardless of user?

             

            -- sent from myPhone --

            Beverly Voth

            --

            • 3. Re: Detecting Operating System Path
              Stephen Huston

              Yes, all of these are relative to the Client machine's logged in user.

              • 4. Re: Detecting Operating System Path
                Nehme

                In fact, I want to store a file in the computer that is "not accessible" by the user.

                 

                As you know, the user visits frequently the Desktop and the Documents forlder and might delete this file.

                The Filemaker path does not exist if we are running a runtime solution.

                The Get (TemporaryPath) has the inconvenience of deleting the file after closing the software.

                 

                This is why I am aiming those types of folders.

                Do you have any ideas?

                • 5. Re: Detecting Operating System Path
                  Nehme

                  It is mainly for a runtime solution (for a single user).

                  • 6. Re: Detecting Operating System Path
                    Stephen Huston

                    The Get(FileMakerPath) allows for placing a file inside FileMaker's application folder, which most users don't bother with normally. And that location won't change for FileMaker even if the application folder were to be moved, since it's based on the App itself.

                    • 7. Re: Detecting Operating System Path
                      Nehme

                      Yes, you're right.

                      But the idea is that the user that uses a runtime solution won't have the Filemaker installed on his computer.

                      He will only have the runtime solution folder.

                      This is why the Filemaker path does not exist.

                      • 8. Re: Detecting Operating System Path
                        BowdenData

                        You can get the info needed by executing a command line function. On Windows, at the command prompt, type "set" and press the return key. This will show you a bunch of system environment variables. The one you want is "Systemroot". So, you can just type on the command line, "set systemroot" and it will return the path to the Windows folder. To my knowledge, the folders System and System32 will always be inside of the Windows folder.

                         

                        This script snippet will output to a file in the TEMP folder and define a variable that you can use to then turn around and import that file into your FM dB. The contents of the file in this case will simply be "SystemRoot=C:\Windows". Then, parse the value imported to obtain what you want.

                         

                        #

                        Send Event [ open document;

                         

                        Let (

                        [
                        ~command = "cmd /c set systemroot > " ;
                        ~fmTemp = Get ( TemporaryPath );
                        ~osTemp = Right ( Substitute ( ~fmTemp ; "/"; "\\") ; Length ( ~fmTemp ) - 1 );

                        ~filename = "systemroot.txt";
                        ~output = ~osTemp & ~filename ;
                        ~fullCommand = ~command & ~output ;
                        $importFile = "filewin:" & ~fmTemp & ~filename

                        ];

                        ~fullCommand

                        )

                        ]

                        #Now import the file represented by $importFile. Do this into a single record table, etc. #

                         

                         

                        Doug

                        • 9. Re: Detecting Operating System Path
                          monkeybreadsoftware

                          If you use MBS Plugin, it's just one of those functions:

                           

                          http://www.mbsplugins.eu/component_Folders.shtml

                          • 10. Re: Detecting Operating System Path
                            user19752

                            Get(FileMakerPath) returns proper value on runtime. Filemaker installation not affect to it.

                            • 11. Re: Detecting Operating System Path
                              Nehme

                              I didn't know that.

                              What does Get(FileMakerPath) return if we don't have the Filemaker Pro installed on the computer?

                              Does it return the runtime solution folder?

                              Or does it create a folder in the programs folder (named Filemaker)?

                              • 12. Re: Detecting Operating System Path
                                Nehme

                                Very good suggestion, thank you.

                                But it is unfortunate that the system folder path works only for windows.

                                • 13. Re: Detecting Operating System Path
                                  TomHays

                                  Nehme wrote:

                                   

                                  In fact, I want to store a file in the computer that is "not accessible" by the user.

                                   

                                  As you know, the user visits frequently the Desktop and the Documents forlder and might delete this file.

                                  The Filemaker path does not exist if we are running a runtime solution.

                                  The Get (TemporaryPath) has the inconvenience of deleting the file after closing the software.

                                   

                                  This is why I am aiming those types of folders.

                                  Do you have any ideas?

                                   

                                   

                                  Once you locate a path that is inaccessible to the user, how do you plan on storing a file there?  System paths require special permissions (or should anyway) to write files.

                                   

                                  If you are successful, you may get into some difficulty with users down the road when it is discovered that your solution puts files into unusual places.  Some users get very uncomfortable with software that puts files outside the normal places.

                                   

                                  I am guessing that Get(PreferencesPath) will be your best option.

                                   

                                  -Tom

                                  • 14. Re: Detecting Operating System Path
                                    Stephen Huston

                                    Yes, Get(FileMakerPath) should return the location of the runtime appllication, inside the runtime folder.

                                     

                                    Yes, the user can access that location if they try hard enough, but they can mess up any of the Runtime App if they start messing with that directory's content anyway. Might as well use it, as it's just as safe or vulnerable to user abuse as the runtime app itself. If you give them a shortcut to the runtime placed outside the runtime folder, most users won't ever open the runtime directory at all.

                                    1 2 Previous Next