AppleScript to JavaScript for InDesign Package
Hello,
I need your expert help in converting my AppleScritpt to JavaScript. I'm not a script writer but I have created this small script to create packages along with the PDFs and zip it all together.
Here's my AppleScript:
with timeout of 86400 seconds
tell application "Adobe InDesign CS5"
set myDocument to active document
set docName to name of myDocument
set sourceName to text 1 thru -6 of docName
set sourcePath to the file path of myDocument as string
tell application "Finder"
set packFolder to make new folder at sourcePath with properties {name:sourceName & "_Package"}
end tell
tell active document
save myDocument
set PrintPDF to (packFolder as string) & sourceName & ".pdf" as string
export format PDF type to PrintPDF using "KMMS_RRD_Print" without showing options
set WebPDF to (packFolder as string) & sourceName & "-Web.pdf" as string
export format PDF type to WebPDF using "KMMS_Web Ready" without showing options
set idmlFile to (packFolder as string) & sourceName & ".idml"
export myDocument format InDesign markup to file idmlFile
package to alias (packFolder as string) copying fonts yes copying linked graphics yes including hidden layers yes copying profiles no updating graphics yes ignore preflight errors yes creating report no
close myDocument
end tell
end tell
--Creating a zip file of the package folder and deleting the folder
tell application "Finder"
set theItem to packFolder as alias
set itemPath to quoted form of POSIX path of theItem
--set fileName to name of theItem
set theFolder to POSIX path of (container of theItem as alias)
set zipFile to quoted form of (theFolder & sourceName & "_Package.zip")
do shell script "cd " & itemPath & ";zip -r " & zipFile & " *"
end tell
end timeout
