Hey-ho, folks–
The script I have included below could be quite handy for us on a daily basis if I could only get the files to go where I want them to. This script was provided by the makers of the software mentioned (Preps). However, they have the dpath (default path?) set to save to the desktop. I would like to save them to this path “Desktop/Preps522/Jobs”, instead. How do I accomplish this? Any help would be greatly appreciated.
(*
tell application "Terminal"
activate
--do script "grep --help" in the front window
do script "grep 'Signature' 75108_FSI_412r06_77.tpl"
end tell
*)
--do shell script "grep --help"
-------------------------------------
--Drag and drop a template from the local Templates folder onto the script. It will create a preps job with blank pages and the template added.
--Will only add patent bind templates by Autoselect.
--The chosen template must have the option of Autoselect selected before using in this script.
--If not a patent bind template, add the template manually after the script runs.
--March 2007.
--(*
on open myfiles
repeat with onefile in myfiles
-- *)
set mytemplate to ""
tell application "Finder"
--set mytemplate to (choose file) as text
set myfolder to the folder of onefile as text
--display dialog myfolder
set mytemplate to the name of onefile as text
--display dialog mytemplate
set mytemplate to myfolder & mytemplate as text
--display dialog mytemplate
end tell
set dpath to path to desktop
--get the template file name to use for the Preps job file name.
try
set AppleScript's text item delimiters to ":"
set myfilename to text item -1 of mytemplate --full template name
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to "."
set myfinalfilename to text item 1 of myfilename as string --template name with extension removed.
set myjobname to myfinalfilename & ".job" as text --make the job name to save the preps job with.
--activate
--display dialog myjobname
set AppleScript's text item delimiters to ""
on error
set AppleScript's text item delimiters to ""
end try
--get the number of pages per signature from the template internal text.
try
set signame to do shell script "grep 'Signature' " & quoted form of POSIX path of mytemplate
set AppleScript's text item delimiters to "|"
set sigline to text item 3 of signame
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to (ASCII character 32)
set pagecount to text item 2 of sigline
set AppleScript's text item delimiters to ""
on error errmsg
set AppleScript's text item delimiters to ""
display dialog errmsg
end try
set mycount to pagecount as integer
--Make a new Preps job. Insert blank pages per number of pages in the signature. Add the autoselect template to the preps job. Save the preps job and remain open on the desktop.
tell application "Finder"
activate
make new «class PJob» at desktop with properties {name:myjobname}
tell «class PJob» myjobname
repeat mycount times
«event SSPWNsrt» «class BlkP» given «class pnel»:«class RLst»
end repeat
end tell
«event SSPWASel» given «class for »:the front «class PJob», «class UTpl»:mytemplate, «class SPag»:1
save document 1 in dpath
end tell
activate
display dialog "The job is ready to be modified."
--(*
end repeat
end open
--*)
--the end.
--March, 2007.
Thanks to all,
Roger Kidder
Spencer Press, An RR Donnelley Company
Model: G3s and G4s running MacOS9.2.2 and OS X 10.3.9
AppleScript: Script Editor 2.0
Browser: Safari 312.6
Operating System: Mac OS X (10.3.9)