6 Replies Latest reply on Jan 22, 2010 7:47 PM by George99

    Get Windows User Name?



      Get Windows User Name?


      I am a volunteer at a computer training centre for the learning disabled, and am trying to create a simple visual memory game where the results are recorded.


      The centre has Filemaker pro 10 advanced, but all my experience has been with MS access.


      Each users pc is logged into windows in advance by the teacher, I would then like to be able to open the database and automatically pick up the windows user name to identify the student.


      Once they have finished the results to be stored in a central folder for correlation by the teacher.


      Is this posible? 


      I am using Filemaker pro 10 advanced, and windows XP.



      Thanks in advance


      George Humphries

        • 1. Re: Get Windows User Name?
          Steve Wright

          I dont think there is a native way to do this.. correct me if Im wrong....


          You could try using something like below, which strips it from the temporary path on Windows 7 anyway


          This looks for /c:/users/USERNAME/appdata/local........

           and would return USERNAME 


          Im not sure what the path would be on XP so you may have to experiment a little


          let (
          path =  Get ( TemporaryPath ) ;
          start = position(path ; "/" ; 0; 3) +1 ;  // find the position of the third / and add 1
          end = position(path ; "/" ; 0; 4)          // find the position of the fourth /
          ] ;

          Middle ( path ; start ; end - start )     // get the text in the middle of those slashes




          • 2. Re: Get Windows User Name?

            what about making a FM account for each user.

            When the user logs into the PC, a vb script sets the registry value for the name FM picks up when it loads - and sets that to what the windows user is. 

            • 3. Re: Get Windows User Name?
                 I am more than sure funds are limited in your situation, but if you have it you could use Active Directory / FMS to provide a single sign on type of feature.
              • 4. Re: Get Windows User Name?

                Thanks for the replies so far, it sounds like it's possible, but I'm a retired engineer not a programmer.


                Words like registry, active directory are all new to me (I assume FMS means file maker script) and it will take me a while to understand what's being suggested.


                I take it there is no Filemaker "get" command that is suitable.


                George Humphries

                • 5. Re: Get Windows User Name?
                  Steve Wright
                  My example above works on Windows XP, Windows Vista and Windows 7 (I have just tested it)
                  I did however change it slightly to prevent any issues with the temp path, by using the desktop path instead
                  Each user has their own desktop, therefore when logged in, the path to the desktop includes their windows name. 
                  let ([
                          path =  Get ( DesktopPath ) ;
                          start =  position(path ; "/" ; 0; 3) +1 ; 
                          end   =  position(path ; "/" ; 0; 4)         
                  ] ;
                          Middle ( path ; start ; end - start )  
                  Windows XP    :  /C:/Documents and Settings/USERNAMEHERE/Desktop/ 
                  Windows 7      :  /C:/Users/USERNAMEHERE/Desktop/
                  Windows Vista :  /C:/Users/USERNAMEHERE/Desktop/ 
                  The number of the slashes before the user name across all 3 is consistent 
                  • 6. Re: Get Windows User Name?

                    Thanks people, Especially SW.


                    I'll go away and have a play now.


                    I'll probably be back for more help, but so far you've come up trumps.


                    Thanks again.


                    George Humphries:smileyhappy: