Hi,
Your request is a little bit strange to me. Javascript by nature is based on a Object Model. The fact that you can script InDesign with JavaScript stands on the specific InDesign object Model. When you are scripting Switch, you are using the specific Enfocus Switch Object Model.
So if you intend to drive InDesign with a javascript sscript file, I am pretty certain you can't. However, if you are really willing to drive InDesign with a sscript, I guess you should rather use a combination of VB and AppleScript inside a sscript. These languages can be run in a higher scope than Javascript (i.e. the system). That way you can execute VB/APS InDesign code inside a sscript.
On top of that, you could use a single line of VB/APS which consists in executing javascript code inside InDesign.
#VB See :
http://www.adobe.com/content/dam/Adobe/ ... torial.pdf
myInDesign.DoScript(myJavaScriptString, idScriptLanguage.idJavascript)
*APS See:
http://wwwimages.adobe.com/content/dam/ ... ide_AS.pdf
do script myJavaScript language javascript with arguments myParameters
Then all you have to do is to pass the parameters you need in your javascript string.
So one script could be :
sscript say in APS
Code: Select all
-- Is invoked each time a new job arrives in one of the input folders for the flow element.
-- The newly arrived job is passed as the second parameter.
on jobarrived( s, j )
--Retrieving the job path
tell application "Switch_Service"
set theJobPath to path of j
set theJobPath to POSIX path of theJobPath
end tell
--Your js code as string
set js to "app.open( File(\""&theJobPath&"\") ); alert(\"open !\"); app.activeDocument.close(SaveOptions.NO);"
--Calling InDesign to run the js code
tell application "Adobe InDesign CC 2014"
do script js language javascript
end tell
end jobarrived
If you need the VB side, drop an eye onto the documentation.
FWIW,
Loic Aigon
http://www.ozalto.com