View Full Version : Applescript job creation - syntax query

05-08-2007, 01:32 AM
What is the correct syntax for adding a file to a PREPS job?
I'm looking to create an Applescript that will create a new job and add the source file to the runlist.

Script thus far:

on open theDropped
set SourcePdf to name of (info for (item 1 of theDropped))
display dialog SourcePdf
set filepath to alias of (info for (item 1 of theDropped))

tell application "Preps 5"
make new job
get sourcefile SourcePdf

end tell
end open

It's the "get sourcefile SourcePdf" that's wrong. What is the correct command to add files to a runlist?

If anyone has a similar script already coded and working - it would be really appreciated.

Thanks in Advance.

05-08-2007, 01:11 PM
Something like this will give you a good start:

tell application "Finder"
--sets the folder to use for the input files
--change the "Macintosh HD:Users:macuser:Desktop:PrepsFolder:Hot Folder:" to "xxx" where "xxx" is the name of the folder you want to use for the source files.
set the chosen_folder to "Macintosh HD:Users:macuser:Desktop:PrepsFolder:Hot Folder:" as alias
--(choose folder with prompt "Pick the folder you want to use for source files")

--change the "Macintosh HD:Users:macuser:Desktop:PrepsFolder:Postscript Output:" to "xxx" where "xxx" is the name of the folder you want to use for the imposed output from Preps
set outpath to "Macintosh HD:Users:macuser:Desktop:PrepsFolder:Postscript Output:"
--change the "Macintosh HD:Users:macuser:Desktop:PrepsFolder:Imposed:" to "xxx" where "xxx" is the name of the folder you want to move the source files too once imposition completed.
set imposed to "Macintosh HD:Users:macuser:Desktop:PrepsFolder:Imposed:"
set savename to (chosen_folder as text)
set tempList to (every file of the chosen_folder)
set inputfiles to {}
repeat with nthItem in tempList
set inputfiles to inputfiles & (nthItem as file specification)
end repeat
repeat while true
tell application "Finder"
-- check if we have a any EPS files to impose

if exists item 1 of folder chosen_folder then
activate application "Preps 5"
-- wait 10 seconds to allow preps to start
do shell script "sleep 10"

tell application "Preps 5"
if exists front job then
close front job
end if
if not (exists (front job)) then
display dialog "This script will only work if there" & return &
"is no job currently open in Preps :-)" buttons {"OK"} default button 1 with icon 1
do shell script "sleep 5"

end if
--make new mixed files job
make new job with properties {workflow:mixed, name:date}
--insert files from the selected folder
insert inputfiles in filelist of front job with adding to runlist
--autoselects the signatures from the specified Template
--to use another specific template change "Ltr Tutorial PerfectBound" to "xxx" where "xxx" is the name of a template in your templates folder
autoselect signatures for the front job using "Sample Templates:US:Ltr Tutorial PerfectBound"
--print the job to PS file to the selected folder
--To set your device for output change the "SpeedMaster 102" to "xxx" where "xxx" is the nickname of a device setup in Preps
print the front job saving as postscript file saving in outpath to device "Trendsetter"
--save the job in the selected folder
--save the front job in chosen_folder
end tell
-- move the processed items so we don't open it again
move every file of the chosen_folder to imposed
end if
end tell
end repeat
end tell