Copy link to clipboard
Copied
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.
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
...Copy link to clipboard
Copied
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thank you very much for your reply...
Copy link to clipboard
Copied
Hi John, If this solved your problem, please mark my answer correct. Thank you very much. -Rick
Copy link to clipboard
Copied
hi,
your answer works on windows perfectly.
Thank you.