Thanks for any help…
I have a script that auto imposes files for printing using the application Preps 5
my problem is when I come to the save file before printing part I cant get the file to save with the file name…
This script is set to a folder action and the file I drop in the folder is the name I want the job to be saved as…
I’ll try to post the script and thanks again for any help…
property done_foldername : "Finished_Pdfs"
property out_path : "brisque15.1.0:CP_Plates_1:"
property type_list : {"PDF"}
property extension_list : {"pdf"}
on adding folder items to this_folder after receiving these_items
tell application "Finder"
if not (exists folder done_foldername of this_folder) then
make new folder at this_folder with properties {name:done_foldername}
set current view of container window of this_folder to list view
end if
set the target_folder to folder done_foldername of this_folder
end tell
set outpath to out_path as string
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
tell application "Finder"
my resolve_conflicts(this_item, target_folder)
set the target_file to (move this_item to the target_folder with replacing) as alias
end tell
set file_name to the name of item_info
process_item(file_name, outpath)
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
on resolve_conflicts(this_item, target_folder)
tell application "Finder"
set the file_name to the name of this_item
if (exists document file file_name of target_folder) then
set file_extension to the name extension of this_item
if the file_extension is "" then
set the trimmed_name to the file_name
else
set the trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name
end if
set the name_increment to 1
repeat
set the new_name to (the trimmed_name & "." & (name_increment as string) & "." & file_extension) as string
if not (exists document file new_name of the target_folder) then
-- rename to conflicting file
set the name of document file file_name of the target_folder to the new_name
exit repeat
else
set the name_increment to the name_increment + 1
end if
end repeat
end if
end tell
end resolve_conflicts
on process_item(this_item, outpath)
try
set this_item to this_item as string
set outpath to outpath as string
with timeout of 900 seconds
set inputfiles to this_item
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {".pdf"}
set theFile to this_item as string
set nameWithoutExtension to first text item of theFile
set newName to nameWithoutExtension & "_I.pdf"
set AppleScript's text item delimiters to oldDelims
tell application "Preps 5"
launch
say "Starting Script"
if exists front job then
close front job
activate
end if
if not (exists (front job)) then
activate
else
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
return
do shell script "sleep 5"
end if
end tell
tell application "Preps 5"
--make new pdf files job
make new job with properties {workflow:PDF, name:date}
say "new job created"
delay 2
insert inputfiles in the runlist of the front job
say "pages added"
delay 2
autoselect signatures for the front job using "Plzeek"
say "signatures added"
set jobname to nameWithoutExtension
save the front job in done_foldername
delay 2
print the front job saving as PDF file saving in outpath to device "brisque" filename newName
say "job printed"
end tell
end timeout
on error error_message
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end try
end process_item