tomp Posted October 13, 2005 Posted October 13, 2005 On Windows XP, I want to use 'send event' to launch an application on the desktop. I need to use the 'calculation' option. If I use the 'file' option to see the path to a desktop application, it is of the form: file:../../Documents and Settings//Desktop/ Both and can vary which is why I need the calculation option. How can I get the 'Windows username' so I can properly build the calculation? 'Get(username)' returns the Filemaker username, not the windows username and no other 'Get' function seems to provide the necessary information. Or is there another form for the calculation to launch a desktop application from 'send event'? TIA
Sanjai Posted October 13, 2005 Posted October 13, 2005 If you cannot find windows user name from FileMaker Pro, you can keep track of the user name from within your application itself. If it is an application written in c or vb it is easy to find using api.
tomp Posted October 13, 2005 Author Posted October 13, 2005 I don't know how to do that. Would it be a plugin or custom FMP function??
Wim Decorte Posted October 13, 2005 Posted October 13, 2005 In 8 this is easy since we now have the Get(DesktopPath) function. In 7 you need to jump through a few hoops. From a Command line window typing "echo %username%" will give you the name of the currently logged-in user. Trouble is: how do you get that into FM? You can only put data into FM through: - paste - import - ODBC - plugin API Let's work importing. Have a script that does the following Send Event: cmd /c echo %username% > c:usernName.txt (assuming the user has write rights to the c: folder) Make the script pause for a second or two and import that text file. If you don't want any new records created, import into a global with the "update" option. Now you have the user name to calculate your path. Another (cleaner) option is to use a Windows logon script (VBscript) that writes the current user name to the filemaker section of the registry so that the get(userName) function will actually return the name of the OS logon. It needs to be a Windows logon script because FM reads the registry once when it launches, so the info needs to be there before FM starts. Or go with 8 ...
tomp Posted October 14, 2005 Author Posted October 14, 2005 Thank you! It's not pretty, but it gets the job done!
Recommended Posts
This topic is 7328 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now