Copy link to clipboard
Copied
I have an applescript that creates PDF and uploads it to a specific destination. (see below)
I want to invoke this script every time the user "saves" the doc.
I am a novice when it comes InDesign applescripting...I don't know if its possible to attach a script to the "save" function??
I am guessing I need to incorporate an event listener?? again i am guessing. perhaps there is a better way? attach the script to key combo Command-s??
the objective is to give the user the option to send a PDF every time they save a document.
Here is the script thus far:
......................
set _ExportPDF to (display dialog "Send Proof?" with icon caution buttons {"Cancel", "PDF"} default button 2)
tell application "Adobe InDesign CS6"
if button returned of _ExportPDF is "PDF" then
set myFolder to "PDFProofs:"
set _dest to myFolder as Unicode text
set screenSettings to PDF export preset "[High Quality Print]"
set page range of PDF export preferences to all pages
set docName to name of document 1
if docName ends with ".indd" then
set docName to text 1 thru -6 of docName
end if
tell application "Adobe InDesign CS6"
export document 1 format PDF type to (_dest & docName & ".pdf") using screenSettings without options
if modified of active document is true then
tell active document to save
close document 1
end if
(*
tell PDF export preferences
set view PDF to true
end tell
*)
end tell
end if
end tell
......................
i figured it out.
an event listener needs to be placed in the InDesign startup scripts folder
that script listens for the Save events... specifically: afterSave, afterSaveAs, afterSaveACopy
(it could listen for other events as well but i am only interested in the after save functions)
i wanted to trigger my PDF upload script after any of those events...so the script was very simple
tell application "Adobe InDesign CS6"
set myEventNames to {"afterSave", "afterSaveAs", "afterSaveACopy"}
repeat with m
...Copy link to clipboard
Copied
ok i see now where i can save the script as a "start-up" script (i.e. applications>adobe indesign>scripts>startup scripts) but how do i make the script run on "save" the doc??
anyone?? bueller? anyone??
Copy link to clipboard
Copied
The easiest way is to set keyboard shortcut Command-S to your script.
I also set various save/package scripts to common keyboard shortcuts.
gr
Copy link to clipboard
Copied
i figured it out.
an event listener needs to be placed in the InDesign startup scripts folder
that script listens for the Save events... specifically: afterSave, afterSaveAs, afterSaveACopy
(it could listen for other events as well but i am only interested in the after save functions)
i wanted to trigger my PDF upload script after any of those events...so the script was very simple
tell application "Adobe InDesign CS6"
set myEventNames to {"afterSave", "afterSaveAs", "afterSaveACopy"}
repeat with myEventName in myEventNames
make event listener with properties {event type:myEventName, handler:"Macintosh HD:Applications:Adobe InDesign CS6:Scripts:Scripts Panel:Samples:AppleScript:PDFUpload.scpt"}
end repeat
end tell
handler = the path to my PDFUpload applescript
done and done
thank you everyone for your help!! R
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more