I finally am getting some time in my schedule to dedicate to AS again. Time to pick up shelved projects and complete them!
I have a project that I would like to try making more complex. I have a few scripts that do some of these functions separately. I’m printing QuarkXPress files to PDF. Sometimes just one file needs to be input, sometimes it’s a whole folder of folders of Quark files. I’d like to be able to allow the user to choose which mode to begin with. Another feature would allow the user to print a PDF of each page of a Quark file, or a single PDF of each. I’d also like to try to choose the output folder as well.
I worked on one recently for saving each page of a Quark file to EPS files, based on the source file’s name, with some help from the inmates. I’m not sure how to incorporate this, but the naming function would be nice to have. Adding the EPS/PDF choice to the mix would add another level of simplicity for the user, allowing them to use one script that does more instead of lots of small ones.
http://bbs.macscripter.net/viewtopic.php?id=27754
This script could end up processing a great number of Quark files, so for the folders mode would need to process all Quark files inside of sub-folders as well.
Would running the Quark work in subroutines help speed things up? I’ll post more here on this one as I make progress, as long as my free time stays mine!
tell application "Finder"
display dialog "Please choose between File(s) or a Folder." buttons {"File(s)", "Folder"}
set modeChoice to result
display dialog "Please choose between a PDF per page or per file." buttons {"Page", "File"}
set modeChoice to result
display dialog "Please choose an output folder, either the same as the Source or a new folder." buttons {"Source", "New"}
set outputLocation to result
if result is "Folder" then
display dialog "Please choose the input folder."
set inputFolders to choose folder with multiple selections allowed --do script quarkFolder
set theFiles to files of folder inputFolders whose name extension is in {"qxd"} or kind contains "QuarkXPress" or file type is in {"XPRJ", "XPR3"} or creator type is in {"XPRJ", "XPR3"}
repeat with oneFile in theFiles
tell application "QuarkXPress"
activate
open (oneFile as alias) do auto picture import no use doc prefs yes remap fonts no
tell front document
--print to PDF. Choose one PDF or one per page, based on input file name. Save to same location as original. Process all Quark files in all sub-folders.
close saving no
end tell
end tell
end repeat
else
display dialog "Please choose the input file(s)."
set inputFiles to choose file with multiple selections allowed --Limiting to Quark files would be good --do script quarkFiles
set theFiles to files of file inputFiles whose name extension is in {"qxd"} or kind contains "QuarkXPress" or file type is in {"XPRJ", "XPR3"} or creator type is in {"XPRJ", "XPR3"}
repeat with oneFile in theFiles
tell application "QuarkXPress"
activate
open (oneFile as alias) do auto picture import no use doc prefs yes remap fonts no
tell front document
--print to PDF. Choose one PDF or one per page, based on input file name. Save to same location as original.
close saving no
end tell
end tell
end repeat
end if
end tell
tell application "Finder"
activate
display dialog "Done"
end tell
Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox 3.0.4
Operating System: Mac OS X (10.4)