Copy link to clipboard
Copied
Bascially I'm trying to set up an Apple Automator script so that I can key-command or alt-click on a document and a series of things will happen.
1) Document opens
2) Document exports in 'high res' PDF setting.
3) Automator adds "HR" to the file name.
4) Document exports in 'low res' PDF setting.
3) Automator adds "LR" to the file name.
Can this be done? Surely it's not THAT technical?
Some kind of script is no-doubt in order...!
hi,
fill your pdfPresets in the first two lines. Save as Script. Launch by Spark, buttler ... with keyCommand.
(You can also launch it from AS-Editor)
Code could easily be edited as Droplet or Programm ...
...--has to be set by user
property myLowres : "presetNameForLowRes"
property myHighres : "presetNameForHighRes"
tell application "Finder"
set myFiles to selection as alias list
end tell
repeat with i from 1 to count of myFiles
set theFile to item i of myFiles
set testFiles to {folder, file creat
Copy link to clipboard
Copied
hi,
fill your pdfPresets in the first two lines. Save as Script. Launch by Spark, buttler ... with keyCommand.
(You can also launch it from AS-Editor)
Code could easily be edited as Droplet or Programm ...
--has to be set by user
property myLowres : "presetNameForLowRes"
property myHighres : "presetNameForHighRes"
tell application "Finder"
set myFiles to selection as alias list
end tell
repeat with i from 1 to count of myFiles
set theFile to item i of myFiles
set testFiles to {folder, file creator} of (info for theFile)
if testFiles is equal to {false, "InDn"} then
tell application "Adobe InDesign CS5.5"
set myFile to open theFile
set filePath to file path of myFile
set fileName to name of myFile
set {lrFilePath, hrFilePath} to my getTargetPaths(filePath, fileName)
export myFile format PDF type to lrFilePath using PDF export preset myLowres without showing options
export myFile format PDF type to hrFilePath using PDF export preset myHighres without showing options
close myFile saving no
end tell
end if
end repeat
on getTargetPaths(fileObject, nameString)
set folderPath to fileObject as text
set AppleScript's text item delimiters to {"."}
if (count of text items of nameString) is 1 then
set {lr, hr} to {folderPath & nameString & "_lr.pdf", folderPath & nameString & "_lr.pdf"}
else
set {lr, hr} to {folderPath & (text items 1 thru -2 of nameString) & "_lr.pdf", folderPath & (text items 1 thru -2 of nameString) & "_hr.pdf"}
end if
return {lr, hr}
set AppleScript's text item delimiters to {""}
end getTargetPaths
... and please don't ask me anything about 'Automator'
Copy link to clipboard
Copied
Thanks mate! Amazing!
I'll try it all out...
Copy link to clipboard
Copied
Sorry but this seems to happen!
Also, as well as Indesign 5.5 I have Indesign 6, do I just change the name within the code and it'll work? Or should I leave v6 alone with this..?
Much appreciated!
Copy link to clipboard
Copied
Hi,
first: save the script as script, not as text. Suffix: '.scpt' (NOT applescript which is txt-format; you're working on mountain lion¿)
second: No sense in storing it in the ID-Scripts-panel as you want to call it from finder, not from ID (otherwise we've got to change it to work on open documents ...)
third: the only way to run it, is with hotkey (you've allready selected ID-files in the finder) or from AppleScriptEditor-window itself ...
Hope this'll be of some help
Copy link to clipboard
Copied
Wow! It totally worked! You sir, are a lifesaver!
Thanks so much!
Copy link to clipboard
Copied
Hi - this seems like gold, but I get the error
"CS5 got an error: Invalid value for parameter 'using' of method 'export'. Expected PDF export preset, but received nothing"
Compiling the name of my presets above seemed to work OK - anyone have any idea what this could be?
Thanks
Copy link to clipboard
Copied
Are you sure you entered your preset name exactly 100% as it is in your drop-down menu of pre-set options? I klnow very little about this kind of stuff but it would seem to me that you either haven't popped that into the script or put it in incorrectly?
Copy link to clipboard
Copied
No I think I have it OK. Perhaps you could post up a screen of your working script in ScriptEditor so I can see how it should look?
Copy link to clipboard
Copied
Here it is, copied and pasted...
property myLowres : "150dpi A4"
property myHighres : "Press with 3mm Bleed"
tell application "Finder"
set myFiles to selection as alias list
end tell
repeat with i from 1 to count of myFiles
set theFile to item i of myFiles
set testFiles to {folder, file creator} of (info for theFile)
if testFiles is equal to {false, "InDn"} then
tell application "Adobe InDesign CS6"
set myFile to open theFile
set filePath to file path of myFile
set fileName to name of myFile
set {lrFilePath, hrFilePath} to my getTargetPaths(filePath, fileName)
export myFile format PDF type to lrFilePath using PDF export preset myLowres without showing options
export myFile format PDF type to hrFilePath using PDF export preset myHighres without showing options
close myFile saving no
end tell
end if
end repeat
on getTargetPaths(fileObject, nameString)
set folderPath to fileObject as text
set AppleScript's text item delimiters to {"."}
if (count of text items of nameString) is 1 then
set {lr, hr} to {folderPath & nameString & "_LR.pdf", folderPath & nameString & "_lr.pdf"}
else
set {lr, hr} to {folderPath & (text items 1 thru -2 of nameString) & "_LR.pdf", folderPath & (text items 1 thru -2 of nameString) & "_HR.pdf"}
end if
return {lr, hr}
set AppleScript's text item delimiters to {""}
end getTargetPaths
Copy link to clipboard
Copied
Thanks a lot for your help. Still damned if I can get it to work though.
Copy link to clipboard
Copied
Hi Salieri_purple,
I also guess that you don't implement the presetnames correctly.
try to run this script. The chosen presetname will be copied to the clipboard.
Then paste it to the first script using ... cmd + v
tell application "Adobe InDesign CS5.5"
set myPresets to name of every PDF export preset
end tell
set the clipboard to (item 1 of (choose from list myPresets with prompt "Please choose your pdf export preset(s)" without multiple selections allowed))
Hans-Gerd Claßen
Copy link to clipboard
Copied
I really love this script and got it working just fine.
I was wondering how I could get it to work within InDesign (CS5.5) instead of the finder. So that the script would convert the currently opened documents without closing them.
Copy link to clipboard
Copied
Hi,
could just test with CS3 at the moment, but guess it should work.
--has to be set by user
property myLowres : "yourLowRes"
property myHighres : "yourHighRes"
tell application "Adobe InDesign CS3"
set myDocs to every document
repeat with i from 1 to count of myDocs
try
set myDoc to (item i of myDocs)
set filePath to file path of myDoc
set fileName to name of myDoc
set {lrFilePath, hrFilePath} to my getTargetPaths(filePath, fileName)
export myDoc format PDF type to lrFilePath using PDF export preset myLowres without showing options
export myDoc format PDF type to hrFilePath using PDF export preset myHighres without showing options
on error e
display dialog e giving up after 5
end try
end repeat
end tell
on getTargetPaths(fileObject, nameString)
set folderPath to fileObject as text
set AppleScript's text item delimiters to {"."}
if (count of text items of nameString) is 1 then
set {lr, hr} to {folderPath & nameString & "_lr.pdf", folderPath & nameString & "_lr.pdf"}
else
set {lr, hr} to {folderPath & (text items 1 thru -2 of nameString) & "_lr.pdf", folderPath & (text items 1 thru -2 of nameString) & "_hr.pdf"}
end if
return {lr, hr}
set AppleScript's text item delimiters to {""}
end getTargetPaths
Hope it'll work Happy weekend!
Hans-Gerd Claßen
Copy link to clipboard
Copied
Wow that was quick Hans, thanks!
I'll be sure to check it out after the weekend.
Copy link to clipboard
Copied
Woop woop freekin awesomez dood
But seriously, this has saved me so much time, thank you greatly!