• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is it possible to get the current computer name in Extendscript

Engaged ,
Jan 13, 2016 Jan 13, 2016

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

TOPICS
Actions and scripting

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jan 14, 2016 Jan 14, 2016

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

...

Votes

Translate

Translate
Adobe
Enthusiast ,
Jan 13, 2016 Jan 13, 2016

Copy link to clipboard

Copied

Check out app.systemInformation, it has a lot of things.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 14, 2016 Jan 14, 2016

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"));

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 14, 2016 Jan 14, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 18, 2016 Jan 18, 2016

Copy link to clipboard

Copied

Hi Mikaeru,

Its awesome and work like charm...!!!

Much Appreciated!!..

-yajiv

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 16, 2018 Apr 16, 2018

Copy link to clipboard

Copied

LATEST

How to get System Name in Extend script for windows os environment

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines