Skip to main content
Inspiring
November 17, 2015
Answered

Is it Possible terminal command via ExtendScript toolkit?

  • November 17, 2015
  • 2 replies
  • 1444 views

Hi everyone!

I need to use terminal command using javascript on extendscript.

But, i will automate the script on macintosh and windows operating systems.

Is it possible to use both in same code?

For Example,  i will automate the pdffonts names in the pdf files. so, i use the command on mac "pdffonts /Users/user/Desktop/fontlist/pdf"  that gives the pdf font names. That works on manually. Is it possible to use code for mac and windows on extendscript toolkit?  or separately give a code!

Thanks,

Peter.

This topic has been closed for replies.
Correct answer frameexpert

I am not sure how this works on the Mac, but with Windows, you can have your commands in a batch file and then execute that with ExtendScript. For example, here is a script that creates a batch file and then executes it:

var bat = File ("~\\temp.bat");

bat.open ("w");

bat.writeln ('start Notepad.exe "C:\\DATA\\Scripts\\results.log"');

bat.writeln ('quit');

bat.close ();

bat.execute (); // This is what runs the batch file (like a double-click on it in Windows Explorer).

You can detect the OS that the script is running on by using $.os. On my system this

alert ($.os);

displays "Windows/7/64 6.1 Service Pack 1 (32-bit emulation)". -Rick

2 replies

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
November 17, 2015

I am not sure how this works on the Mac, but with Windows, you can have your commands in a batch file and then execute that with ExtendScript. For example, here is a script that creates a batch file and then executes it:

var bat = File ("~\\temp.bat");

bat.open ("w");

bat.writeln ('start Notepad.exe "C:\\DATA\\Scripts\\results.log"');

bat.writeln ('quit');

bat.close ();

bat.execute (); // This is what runs the batch file (like a double-click on it in Windows Explorer).

You can detect the OS that the script is running on by using $.os. On my system this

alert ($.os);

displays "Windows/7/64 6.1 Service Pack 1 (32-bit emulation)". -Rick

www.frameexpert.com
AD4003Author
Inspiring
November 19, 2015

Thank you very much for your reply...

frameexpert
Community Expert
Community Expert
November 19, 2015

Hi John, If this solved your problem, please mark my answer correct. Thank you very much. -Rick

www.frameexpert.com
Participating Frequently
November 17, 2015