Copy link to clipboard
Copied
Hi EveryOne!,
This is a Mac OS X environment and Is it possible to get the current full Username and computer name in Extendscript?
-yajiv
User name:
alert ($.getenv('USER'));
From ps-scripts.com • View topic - Mac Environmental Variables‌:
function getSystemCommandStdout (command)
{
var stdout = null;
var tempFile = new File (Folder.temp + "/temp.txt");
app.system (command + " > " + tempFile.fsName);
if (tempFile.open ("r"))
{
stdout = tempFile.read ();
tempFile.close ();
tempFile.remove ();
}
return stdout;
}
Computer name:
alert (getSystemCommandStdout ("hostname -s").trim ());
Short user name:
...alert (g
Copy link to clipboard
Copied
Check out app.systemInformation, it has a lot of things.
Copy link to clipboard
Copied
$.writeln("ALLUSERSPROFILE == "+ $.getenv("ALLUSERSPROFILE"));
$.writeln("APPDATA == "+ $.getenv("APPDATA"));
$.writeln("CommonProgramFiles == "+ $.getenv("CommonProgramFiles"));
$.writeln("COMPUTERNAME == "+ $.getenv("COMPUTERNAME"));
$.writeln("ComSpec == "+ $.getenv("ComSpec"));
$.writeln("HOMEDRIVE == "+ $.getenv("HOMEDRIVE"));
$.writeln("HOMEPATH == "+ $.getenv("HOMEPATH"));
$.writeln("LOGONSERVER == "+ $.getenv("LOGONSERVER"));
$.writeln("NUMBER_OF_PROCESSORS == "+ $.getenv("NUMBER_OF_PROCESSORS"));
$.writeln("OS == "+ $.getenv("OS"));
$.writeln("Os2LibPath == "+ $.getenv("Os2LibPath"));
$.writeln("Path == "+ $.getenv("Path"));
$.writeln("PATHEXT == "+ $.getenv("PATHEXT"));
$.writeln("PROCESSOR_ARCHITECTURE == "+ $.getenv("PROCESSOR_ARCHITECTURE"));
$.writeln("PROCESSOR_IDENTIFIER == "+ $.getenv("PROCESSOR_IDENTIFIER"));
$.writeln("PROCESSOR_LEVEL == "+ $.getenv("PROCESSOR_LEVEL"));
$.writeln("PROCESSOR_REVISION == "+ $.getenv("PROCESSOR_REVISION"));
$.writeln("ProgramFiles == "+ $.getenv("ProgramFiles"));
$.writeln("SystemDrive == "+ $.getenv("SystemDrive"));
$.writeln("SystemRoot == "+ $.getenv("SystemRoot"));
$.writeln("TEMP == "+ $.getenv("TEMP"));
$.writeln("TMP == "+ $.getenv("TMP"));
$.writeln("USERDOMAIN == "+ $.getenv("USERDOMAIN"));
$.writeln("USERNAME == "+ $.getenv("USERNAME"));
$.writeln("USERPROFILE == "+ $.getenv("USERPROFILE"));
$.writeln("windir == "+ $.getenv("windir"));
Copy link to clipboard
Copied
User name:
alert ($.getenv('USER'));
From ps-scripts.com • View topic - Mac Environmental Variables‌:
function getSystemCommandStdout (command)
{
var stdout = null;
var tempFile = new File (Folder.temp + "/temp.txt");
app.system (command + " > " + tempFile.fsName);
if (tempFile.open ("r"))
{
stdout = tempFile.read ();
tempFile.close ();
tempFile.remove ();
}
return stdout;
}
Computer name:
alert (getSystemCommandStdout ("hostname -s").trim ());
Short user name:
alert (getSystemCommandStdout ("id -P | cut -d: -f1").trim ());
Full user name:
alert (getSystemCommandStdout (
"id -P | cut -d: -f8").trim ());
HTH,
--Mikaeru
Copy link to clipboard
Copied
Hi Mikaeru,
Its awesome and work like charm...!!!
Much Appreciated!!..
-yajiv
Copy link to clipboard
Copied
How to get System Name in Extend script for windows os environment