my company is in the process of making a switch from MultiAd Creator Pro to Indesign.
i wrote a script for MultiAd that uploads a pdf file to select volume/folder when the user saves the doc.
so …the user saves the doc. and is then prompted yes/no save the “Send Proof”? if yes then… the script uploads a PDF to a select destination.
below is the Creator script
pproperty PDFPath : “PDFProofs:”
using terms from application “MultiAd Creator Pro”
on saved theDoc
set question to display dialog “Send Proof?” buttons {“Yes”, “No”} default button 2
set answer to button returned of question
if answer is “Yes” then
set fileName to name of theDoc
set destFolder to PDFPath
--Trim off .crtr extension if it has one:
if fileName ends with ".crtr" then
set sd to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
set fileName to (text items 1 thru -2 of fileName) as text
set AppleScript's text item delimiters to sd
end if
tell application "MultiAd Creator Pro"
export PDF current spread of theDoc saving in (destFolder & fileName & ".pdf") print order user order export method composite output color space CMYK stand in resolution 300 black and white compression use zip color image compression use JPEG quality 80 with embed no base 14 fonts, use doc size, binary encoding and compress text and line art without print as spreads, crop marks, registration marks, color bars, document notes, plate information, text blocks only and presentation mode
end tell
tell application "Finder"
activate
tell application "MultiAd Creator Pro"
activate
end tell
end tell
end if
end saved
end using terms from
…
IMO the script is fairly straightforward but i am not sure how to convert it into a Indesign script that would work in the background??
plus i don’t know how to capture the “export PDF” information (i.e. the preset PDF criteria) from Indesign.
there is no way to record scripts from with Indesign?? like photoshop?
any help would be greatly appreciated. thank you in advance rick
set _ExportPDF to (display dialog "Send Proof?" with icon caution buttons {"Cancel", "PDF"} default button 2)
tell application "Adobe InDesign CC 2015"
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 "YOUR PDF PRESET NAME HERE"
set page range of PDF export preferences to all pages
set docName to name of document 1
if docName ends with ".crtr" then
set docName to text 1 thru -2 of docName
end if
tell application "Adobe InDesign CC 2015"
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
here is the current script. i need to figure out how make it run every time the user saves the doc. (save or save as). the script should always be “on” and not activated manually…any thoughts??
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
You could add the script to the ‘Scripts’ window. You can find that under Window > Utilities > Scripts.
The user could then select the script from there.
Or, there’s always third-party apps which can be used to assign a script to a keyboard shortcut.
For example FastScripts.
adding it to the scripts window would still require the user to activate the script “manually” i.e. click on it. unfortunately, this doesn’t happen in reality lol.
the end user forgets to send the proof. that is why i want to tie it into an event such as “save”.
i thought of trying to making the script into a key combo but again it would require the user to remember to do it…
if they are prompted to send a proof every time they save…it eliminates a degree of human error
what your looking for is called an event listener, basically it waits for an event to occur, in your case your waiting for the
user to save, to have your script run.
You could do it via java script, but I don’t no how to write it, and put that script in your start up scripts folder, or you could try the below applescript set up.
Save your main script to where ever you want it to reside, and get the path to it
Put the path and the name of you script in the below script, then run it
open an indesign file and then goto save it, you should have your main script fire
set OnSaveScript to (path to desktop folder as string) & "Test.scpt" -- PATH TO YOUR SCRIPT
-- or
--set OnSaveScript to "Macintosh HD:Users:rick_260:Desktop:TEST.scpt" -- PATH TO YOUR SCRIPT
tell application "Adobe InDesign CC 2015"
delete every event listener
make new event listener with properties {event type:"beforeSave", handler:OnSaveScript, cancelable:true}
--make new event listener with properties {event type:"beforeSaveAs", handler:OnSaveScript, cancelable:true}
--make new event listener with properties {event type:"beforeSaveACopy", handler:OnSaveScript, cancelable:true}
end tell
To delete your event listeners, run this
tell application "Adobe InDesign CC 2015"
delete every event listener
end tell