Hi all,
I am having problems with this script, mostly the second repeat loop. I need a little help. I am trying to open documents in each “month” folders and print a PostScript file to an “In” folder for Acrobat Distiller to watch and create a PDF file.
I am using OS 9.1, FaceSpan 3.5, QuarkXPress 4, and PreFab Player.
Thanks. Sean
on hilited theObj
set Counter to 0
tell application "Finder"
activate
set CommonPath to folder "PDF Folder" of folder "Misc Storage" of desktop
set Monthcounter to 1
repeat while Monthcounter < 13
if Monthcounter is equal to 1 then
set MonthFolder to "January Production"
if Monthcounter is equal to 2 then
set MonthFolder to "February Production"
if Monthcounter is equal to 3 then
set MonthFolder to "March Production"
if Monthcounter is equal to 4 then
set MonthFolder to "April Production"
if Monthcounter is equal to 5 then
set MonthFolder to "May Production"
if Monthcounter is equal to 6 then
set MonthFolder to "June Production"
if Monthcounter is equal to 7 then
set MonthFolder to "July Production"
if Monthcounter is equal to 8 then
set MonthFolder to "August Production"
if Monthcounter is equal to 9 then
set MonthFolder to "September Production"
if Monthcounter is equal to 10 then
set MonthFolder to "October Production"
if Monthcounter is equal to 11 then
set MonthFolder to "November Production"
if Monthcounter is equal to 12 then
set MonthFolder to "December Production"
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
repeat while Monthcounter < 13
set OrigpathBK to folder "Bank" of folder MonthFolder of CommonPath
set NewpathBK to folder "In" of folder "Bank" of folder MonthFolder of CommonPath
tell OrigpathBK
set filelist to (every file whose (file type is "XDOC"))
repeat with thisfile in filelist
if exists thisfile then
open thisfile
end if
tell application "QuarkXPress™ 4.11"
activate
tell application "PreFab Player™"
try
do menu menu item "Export as PDF..." of menu "Utilities"
set Counter to Counter + 1
click button 1
if exists button 1 then
click button 1
if exists button 1 then
click button 1
end if
end if
on error number errNum -- error trap
if errNum is -1712 then
tell application "QuarkXPress™ 4.11"
close thisfile saving no
end tell
tell application "Finder"
if not (exists folder "ERRORS" of OrigpathBK) then
make new folder at OrigpathBK
select folder "untitled folder"
set name of selection to "ERRORS"
end if
move thisfile to folder "ERRORS" of OrigpathBK
end tell
else if errNum is -1712 and (exists button 2) then -- error with clicking save
click button 2
tell application "QuarkXPress™ 4.11"
close thisfile saving no
end tell
tell application "Finder"
if not (exists folder "ERRORS" of OrigpathBK) then
make new folder at OrigpathBK
select folder "untitled folder"
set name of selection to "ERRORS"
end if
move thisfile to folder "ERRORS" of OrigpathBK
end tell
end if
end try -- end error trap
end tell
if exists document 1 then
close document 1 saving no
end if
end tell
end repeat
end tell
move (every file of CommonPath whose (file type is not "XDOC")) to NewpathBK with replacing
set Monthcounter to Monthcounter + 1
end repeat
end repeat
end tell
end hilited