Skip to main content
Participant
June 20, 2015
Question

How to pass a variable from Applescript to Indesign script?

  • June 20, 2015
  • 2 replies
  • 615 views

I'm using the excellent MultiPageImporter2.5-CS5.jsx script from Zanelli to import a PDF file in an Indesign document. The (Java)script starts with a popup and asks for the starting page to place the imported PDF.

How can I pass a variable to this script from Applescript with the page number where to place the PDF file and continue without having to manually fill this out in the MultiPageImporter2.5-CS5.jsx popup ?

Here's the applescript that gets the page numbers into variable thismanypages, how to pass this on to MultiPageImporter2.5-CS5.jsx in Indesign in the next step?

tell application "Adobe InDesign CS5.5"

  tell document 1

  set thismanypages to count pages

  end tell

end tell

set aScriptPath to "Users:admin:Library:Preferences:Adobe InDesign:Version 7.5:en_US:Scripts:Scripts Panel:MultiPageImporter2.5-CS5.jsx"

tell application "Adobe InDesign CS5.5"

  do script alias aScriptPath language javascript

end tell

This topic has been closed for replies.

2 replies

Inspiring
June 22, 2015

From the AS, variable thismanypages returns the total number of pages in a document, where does this number fit in the dialog box? ( '1' thru '1' or 'Start Placing on Doc Page' fields)

Would it be easier to modify Scott's jsx script using JS?

Kasyan Servetsky
Legend
June 22, 2015

I think you can pass the variable in arguments. I can't give you an example because don't have assess to Mac at the moment.  See the "DoScriptScriptArgs.applescript" example in the scripting guide.