6 Replies Latest reply on Jul 20, 2012 11:08 AM by philmodjunk

    How to derive the local system user name

    dzittin

      Title

      How to derive the local system user name

      Post

      Hi,

      I would like to obtain the local user name as per the system login name, in a script, not the FM user name.

      FM allows me to get the user name embedded in path strings, for example get(DesktopPath). I can parse the user's name out of this path, but I would rather not for fear that the name will not always be second to last, or can I rely on this?

      Is there a function I have missed that returns this name in a script?

       

      Thanks,

      -D

        • 1. Re: How to derive the local system user name
          schamblee

          To get the user name in filemaker 12 you use Get(UserName) or Get(AccountName). 

          • 2. Re: How to derive the local system user name
            dzittin

            Hi S. C.

            Thanks for the reply. I am not sure these solutions will work because they are both assigned from within FM. If I am user "Jane" on my Windows machine. I can be "DataBaseJoe" while running an instance of FM because the use can be set via a preference panel (Edit).

            I need to get to a place in the file system with user "Jane", not "DataBaseJoe".

            I know that FM has this data and will give it to me in various paths, but I don't want to do the parsing and chance that something might change.

            I think I may be suffering from confustion over the machine I am developing on which has "My Documents" on hard disk which is different than the one that Documents and Settings is located. This may be a non-issue. No need to reply. I need to figure out of I can use get(DocumentsPath) in my case.

            Thanks again,

            -D

            • 3. Re: How to derive the local system user name
              philmodjunk

              Or maybe get ( desktopPath ) since each user has their own desktop directory with their user name. (At least it does in Windows...)

              Either way, I think you can rely on the 2nd to last directory name being the user's local user account name.

              • 4. Re: How to derive the local system user name
                dzittin

                Thanks PhilModJunk,

                I solved the problem by having the installer output a tiny .csv into the runtime folder. On startup, I have my FM initialization pick up this value which contains the path to the folder I want my help features and data dumps to occur into. The path is imported into a single field global table. The installer uses system environmental variable so these values will always be correct for the machine on which the FM runtime is installed, at least I think this will be true. More testing to be sure though.

                • 5. Re: How to derive the local system user name
                  dzittin

                  I fogot to mention that the runtime folder is always available via get(FilePath). Getting rid of the last element of that path and replacing it with the name of the file containing the path spec does the trick.

                  • 6. Re: How to derive the local system user name
                    philmodjunk

                    I've heard of anti-piracy tricks that used such a file, but it was either hidden or added to the registry and then the solution checked for the file and the data in it when first opened. Given some of your other discussions, that trick may be worth investigating.