5 Replies Latest reply on Apr 16, 2018 12:39 AM by kiranks48360295

    Is it possible to get the current computer name in Extendscript

    natrev Level 3

      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

        • 1. Re: Is it possible to get the current computer name in Extendscript
          matias.kiviniemi Level 3

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

          • 2. Re: Is it possible to get the current computer name in Extendscript
            Pedro Cortez Marques Level 3

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

            • 3. Re: Is it possible to get the current computer name in Extendscript
              Mikaeru69 Level 3

              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

              • 4. Re: Is it possible to get the current computer name in Extendscript
                natrev Level 3

                Hi Mikaeru,

                 

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

                Much Appreciated!!..

                 

                -yajiv

                • 5. Re: Is it possible to get the current computer name in Extendscript
                  kiranks48360295

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