Copy link to clipboard
Copied
Hi
Is that possible to run system command in indesign javascript?
Becase i need to run a command in run prompt while script running in .indd file.
Any idea please let me know
Copy link to clipboard
Copied
There are at least five answers
I Hope this is helpful
Copy link to clipboard
Copied
Hi Maciej,
For time being i m already using the execute() only for generating pdf from ps.
In this case i cant able set job option in distiller.
The problem y i m trying to run system command is i need pass some parameters (ie., job option, mypsFile) through my script.
Is there any other sollutions?
Thank and Regards
Christy
Copy link to clipboard
Copied
Distiller has the option to set up 'watched folders' each of these folders can have its own set of .joboptions applied as a rule. You could either write your postscript file to that location or move it there once written. The other option on the mac OS would be Distiller is scriptable thru AppleScript it only has 3 parameters so you could call that and pass it the strings?
#target indesign var psFile = new File('~/Desktop/Test Folder/Testing.ps'); var pdfFile = new File('~/Desktop/Testing.pdf'); var optsFile = new File('/Library/Application Support/Adobe/Adobe PDF/Settings/Press Quality.joboptions'); distillPS(psFile, pdfFile, optsFile); if (pdfFile.exists) alert('Done it…'); function distillPS(sp, dp, opts) { if (!sp instanceof File || !sp.exists) return false; if (!dp instanceof File) return false; if (!opts instanceof File || !opts.exists) return false; // Wants POSIX paths but NOT using '~' home var sourcePath = 'Distill sourcePath "' + sp.fsName + '"'; var destPath = ' destinationPath "' + dp.fsName + '"'; var settingsPath = ' adobePDFSettingsPath "' + opts.fsName + '"'; var allPaths = sourcePath + destPath + settingsPath; // Concat the AppleScript string var pstoPDF = '' + 'tell application "Acrobat Distiller 7.0"' + '\n' + 'activate' + '\n' + allPaths + '\n' + 'quit' + '\n' + 'end tell' + '\n' var result = app.doScript(pstoPDF, 1095978087); return Boolean(result); }
I added option 4 for the mac. It worked for me with CS2 and Distiller 7. No system check included tho. Just expects 3 File objects 2 of which must exist…