General Applescripting Info

Started by Slappy, April 18, 2013, 12:41:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Slappy

Every so often I'll get the ambition to script something, either in the Finder of InDesign or whatever. Here's my latest wanna-do:

Since 90% of the jobs we do require both a low-res PDF for the client & then a hi-res PDF for press, I want a script for InDesign that will do exactly that, based on our existing PDF Presets. It should create each PDF, place them in the sub-folder within the document directory (on the server) and append either "_Proof" or "_Print" to the end also.

I found one somebody else created, and modified it to use the Presets as I want but it's set to create a folder on the Desktop for the resulting PDFs. I don't want to copy them back to the job folder on the server but damned if I can find the right syntax to direct the script back to the job's folder on the server. Here's that script if anybody can use it, and better yet, figure out how to get the PDFs written to the server:


property baseFolder : (path to desktop as text) & "exports:"
--
on open mgItems
repeat with mgThisItem in mgItems
tell application id "com.adobe.InDesign"
try
open mgThisItem
set mgDocName to name of active document
set text item delimiters of AppleScript to " "
set mgShortName to text item 1 of mgDocName
set targetFolderPath to my createFolder(mgShortName)
set text item delimiters of AppleScript to ""
set mgHRFilePath to targetFolderPath & mgShortName & "_Proof.pdf" as string
set properties of PDF export preferences to properties of PDF export preset "Customer Proof-No Crops"
tell the active document to export format PDF type to mgHRFilePath without showing options
set mgHRDigitalFilePath to targetFolderPath & mgShortName & "_Print.pdf" as string
set properties of PDF export preferences to properties of PDF export preset "Heidelberg"
tell the active document to export format PDF type to mgHRDigitalFilePath without showing options

close active document
on error e
display dialog e
end try
end tell
end repeat
display dialog "PDFs created in <JobName> Folder"
end open
--
on createFolder(nameString)
set macFolderPath to baseFolder & nameString
do shell script "mkdir -p " & quoted form of POSIX path of macFolderPath
return macFolderPath & ":"
end createFolder
A little diddie 'bout black 'n cyan...two reflective colors doin' the best they can.