Skip to main content
M V SHAJI
Known Participant
February 21, 2014
Question

How to get "Domain" name using "ExtendScript ToolKit"

  • February 21, 2014
  • 1 reply
  • 1579 views

Hi all,  We got a requirement to get the "Domain" name using JavaScripting.  I am using MAC OS 10.6.8 with Indesign CS 6.  I tried using the below code to get the "USER" name, but not able to get the "Domain" name.  alert($.getenv("USER"))  Is there is any other method to get the "Domain" name, please suggest.  Thanks,  Shaji

This topic has been closed for replies.

1 reply

BEGINNER_X
Legend
February 21, 2014

Hi Shaji,

May the below coding will helpful for you...

var myAppleScript3 = 'tell application "Finder"\r';

myAppleScript3 += 'do shell script "whoami"\r';

myAppleScript3 += 'end tell\r';

var username =app.doScript(myAppleScript3, ScriptLanguage.applescriptLanguage);

alert("username: "+ username);

Thanks

Siraj

M V SHAJI
M V SHAJIAuthor
Known Participant
February 21, 2014

Hi Siraj,  Thank you so much for the response.  We need to get the "DOMAIN" name not username.  Any help on this please...  Shaji

Legend
February 21, 2014

Hope this may help you,

var batCreation = new File("/D/test.bat");

var batCode = 'cd D:\\ \n D: \n echo %USERDOMAIN%' + ' > ' +'domain.txt';

batCreation .open( "w" );

batCreation.writeln(batCode);   

batCreation.close();

batCreation.execute();  

var result = File('D:\\domain.txt');

  

while(!result.exists){ $.sleep(5); }   

result.open( 'r' );   

var domainName = result.read();

result.close();

result.remove();

batCreation.remove();

alert(domainName);

Vandy