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

Is it Possible terminal command via ExtendScript toolkit?

Participant ,
Nov 16, 2015 Nov 16, 2015

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.

TOPICS
Scripting
1.5K
Translate
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

Community Expert , Nov 17, 2015 Nov 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

...
Translate
Contributor ,
Nov 17, 2015 Nov 17, 2015
Translate
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
Community Expert ,
Nov 17, 2015 Nov 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

Translate
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
Participant ,
Nov 19, 2015 Nov 19, 2015

Thank you very much for your reply...

Translate
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
Community Expert ,
Nov 19, 2015 Nov 19, 2015

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

Translate
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
Participant ,
Nov 19, 2015 Nov 19, 2015
LATEST

hi,

your answer works on windows perfectly.

Thank you.

Translate
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