Highlighted

Javascript to get my machine's name

Community Beginner ,
Apr 15, 2020

Copy link to clipboard

Copied

Hello,

 

I'm trying to use javascript to get my machine's name: "FSMACLT31",

Screen Shot 2020-04-16 at 2.51.09 PM.png

 

So far, the closest I could get to is the below:

Screen Shot 2020-04-16 at 2.48.56 PM.png

 

Is there another magic word instead of "HOME" would do the trick? 

Thanks heaps for your help!

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi SychevKA,

"computername" would only work on Windows, I think.

 

Unfortunately a lot of the old InDesign Scripting Forum is missing.

In 2011 there was a thread about this issue where someone, I think it was John Hawkinson, answered the question like this:

 

 

if (File.fs == "Windows" ) {
	var myUserName  = $.getenv('username');
	var mySysName  = $.getenv('computername');
	}

else if (File.fs == "Macintosh") {
		   var myUserName  = $.getenv('USER');
		   var mySysName  = app.doScript('do shell script "hostname"', ScriptLanguage.APPLESCRIPT_LANGUAGE);
	}

$.writeln( myUserName +"\r"+ mySysName );

 

 

Also see into this related thread that is still available:

 

$.getenv() on Mac
Jump_Over, Jan 17, 2017

https://community.adobe.com/t5/indesign/getenv-on-mac/td-p/8848527

 

Regards,
Uwe Laubender

( ACP )

TOPICS
Scripting

Views

412

Likes

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

Javascript to get my machine's name

Community Beginner ,
Apr 15, 2020

Copy link to clipboard

Copied

Hello,

 

I'm trying to use javascript to get my machine's name: "FSMACLT31",

Screen Shot 2020-04-16 at 2.51.09 PM.png

 

So far, the closest I could get to is the below:

Screen Shot 2020-04-16 at 2.48.56 PM.png

 

Is there another magic word instead of "HOME" would do the trick? 

Thanks heaps for your help!

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi SychevKA,

"computername" would only work on Windows, I think.

 

Unfortunately a lot of the old InDesign Scripting Forum is missing.

In 2011 there was a thread about this issue where someone, I think it was John Hawkinson, answered the question like this:

 

 

if (File.fs == "Windows" ) {
	var myUserName  = $.getenv('username');
	var mySysName  = $.getenv('computername');
	}

else if (File.fs == "Macintosh") {
		   var myUserName  = $.getenv('USER');
		   var mySysName  = app.doScript('do shell script "hostname"', ScriptLanguage.APPLESCRIPT_LANGUAGE);
	}

$.writeln( myUserName +"\r"+ mySysName );

 

 

Also see into this related thread that is still available:

 

$.getenv() on Mac
Jump_Over, Jan 17, 2017

https://community.adobe.com/t5/indesign/getenv-on-mac/td-p/8848527

 

Regards,
Uwe Laubender

( ACP )

TOPICS
Scripting

Views

413

Likes

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
Apr 15, 2020 1
Explorer ,
Apr 16, 2020

Copy link to clipboard

Copied

alert($.getenv('computername'))

Likes

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
Reply
Loading...
Apr 16, 2020 0
Adobe Community Professional ,
Apr 16, 2020

Copy link to clipboard

Copied

Hi SychevKA,

"computername" would only work on Windows, I think.

 

Unfortunately a lot of the old InDesign Scripting Forum is missing.

In 2011 there was a thread about this issue where someone, I think it was John Hawkinson, answered the question like this:

 

 

if (File.fs == "Windows" ) {
	var myUserName  = $.getenv('username');
	var mySysName  = $.getenv('computername');
	}

else if (File.fs == "Macintosh") {
		   var myUserName  = $.getenv('USER');
		   var mySysName  = app.doScript('do shell script "hostname"', ScriptLanguage.APPLESCRIPT_LANGUAGE);
	}

$.writeln( myUserName +"\r"+ mySysName );

 

 

Also see into this related thread that is still available:

 

$.getenv() on Mac
Jump_Over, Jan 17, 2017

https://community.adobe.com/t5/indesign/getenv-on-mac/td-p/8848527

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Reply
Loading...
Apr 16, 2020 0
tjinnz LATEST
Community Beginner ,
Apr 16, 2020

Copy link to clipboard

Copied

var mySysName  = app.doScript('do shell script "hostname"', ScriptLanguage.APPLESCRIPT_LANGUAGE);

 

Awesome, this is exactly what I am after.

Likes

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
Reply
Loading...
Apr 16, 2020 0