Yeah that should get the user. You could also do something like this.
var myFile2 = File(["/Applications/OPCS"]);
var computerOperator = myFile2.readln();
Then you will have to apply computerOperator to a text box.
Thanks for your reply. I couldn't get your If statment to retun a value but I have managed to get the $.getenv('USER') statment working and returing the home folder name. Which has now presented a new problem. Though everyones account on their mac is now set to their name the orgional accounts for all our macs was set to 'macuser' and this is the name of their home folders. I have researched changing the home folder name but this means going through everyones computer and exporting their user accounts to a new account, something I would dearly like to avoid. Is there a a different comand i can use that will return the Account name other than the deep compter name? I thought it maybe something like $.getenv('ACCOUNT_ID') or something as simple as that.
Thanks once again for you reply.
This $.getenv('USER') should give you the user name. It would depend on what user they are using.
When our IT departemnt set up the macs in our office they just named them all macuser. The users have just modified the account names to theirs but the host folder is still called macuser and that's the string being returned with $.getenv('USER'). If they creat a new account and set it up with their name from the begining then there's no problem and the command works fine. Problem is everyone setting up new accounts when they've got their workspaces set up just how they want them or having to export each account to a new user on each machine. I didn't know if there was a different variable other than USER that would return the login name the accounts set to?
You could check other variables like:
- $.getenv("USERPROFILE") //last part of a path
- $.getenv("HOMEPATH") //last part of a path
Notice it works on Windows. Those names can differ on Mac, i.e. "USERNAME" on Windows is "USER" on Mac.