Kirix Support Forums

userid

Please post any help questions, requests or other feedback here.

userid

Postby abenitez77 on Mon Mar 21, 2011 3:57 pm

How do I get the userid of the logged on user that is using kirix?
abenitez77
Registered User
 
Posts: 143
Joined: Fri Jan 21, 2011 12:42 pm

Re: userid

Postby SLSJax on Mon Mar 21, 2011 4:02 pm

I'll piggyback on the back of that question... How can you get *any* system variable (not just USERNAME). I couldn't find a class that let you pull environmental variables beyond some of the display-related ones.

Thanks!
SLSJax
Registered User
 
Posts: 11
Joined: Fri Mar 18, 2011 10:40 am

Re: userid

Postby Aaron on Mon Mar 21, 2011 4:44 pm

To find out about the system environment, use the Environment class. For example, here's how to get the current user:

Environment.getEnvironmentVariable("USERNAME")

Here's a sample script that shows how to get the values for common system environment variables:

Code: Select all
var env = new Array();
env.push("ALLUSERSPROFILE");
env.push("APPDATA");
env.push("COMPUTERNAME");
env.push("COMSPEC");
env.push("HOMEDRIVE");
env.push("HOMEPATH");
env.push("HOMESHARE");
env.push("LOGONSEVER");
env.push("OS");
env.push("PATH");
env.push("PATHEXT");
env.push("SYSTEMDRIVE");
env.push("SYSTEMROOT");
env.push("TEMP");
env.push("TMP");
env.push("USERDOMAIN");
env.push("USERNAME");
env.push("USERPROFILE");
env.push("WINDIR");


Console.clear();
for (var key in env)
{
    var env_variable = env[key];
    var env_value = Environment.getEnvironmentVariable(env_variable);
    Console.writeLine(env_variable + ": '" + env_value + "'")
}
Aaron Williams
Kirix Support Team
User avatar
Aaron
Kirix Support Team
 
Posts: 120
Joined: Fri Dec 16, 2005 3:01 pm

Return to Strata Help & Feedback