whoa.
larsen. youre bored and this is what you come up with? awesome!
this is where i get into trouble... its like wen you go to a foreign country and you learn enough to order the good food and book a room, and then someone starts talking philosophy... i'm trying to keep up.
this is the entirety of my script, which i know is terrible to post the whole damn thing... but i dont know how else to show you where i'm at. i remoted into my office computer to pick this up, so will wait to look more closely at your script and try it out... i guess what i'm saying is, ive never used the x,y coordinates thing. its been all i can do to figure out an individual button name, and then get some syntax going. this script works about half the time, or it seems to (althou i was tinkering with it a lot yesteray -- which is why there's some stuff commented out, that is just trying to get something to work or not). sometimes it gets all the way thru and then doesnt delete the file (at the very bottom of the script, thus "failing"). i figured if it works once, then it should always work. and if it doesnt work all the time, then its because the script is gonig faster than my computer -- which speaks to server connxn time and file size variances
jean-marie.
i agree with you. the two statements are not the same at all!
THANK YOU, both! i really appreciate your input. i'll just try and figure out how this gels with what i had.....
but here it is... and now youll see how awkward my coding is.

global ansbutton
global collectpath
global Destination
global filea
global fileapath
global joblist
global jobnum
global kcn
global kcnfin
global kcnfinfold
global multi_file
global notdone
global notdone_error
global this_file
set notdone to {}
display dialog ("Input a job number:" & return & "separate by SPACES" & return & return & return & "This will not source files already archived" & return & return & "-- If there is more than one Quark File, the most-recently modified is used") default answer "000125 000124 000123"
set joblist to the text returned of the result as string
set ATID to AppleScript's text item delimiters
set AppleScript's text item delimiters to space
set joblist to (every word of joblist)
set AppleScript's text item delimiters to ATID
repeat until joblist is {}
try
set jobnum to (text item 1 of joblist) as string
set jobnum to ("V" & jobnum) as string
set AppleScript's text item delimiters to ATID
open_jobfile()
set kcn to result
set kcnfin to (the first word of kcn) as string
set kcnfinfold to (kcnfin & " Final") as string
set collectpath to ("//Volumes/CLIENTS/" & jobnum & "/" & kcnfinfold & "/")
make_finfold()
do_collect()
print_cropmarkPDF()
close_file()
stuff_collect()
move_2_Collect()
delay 1
on error
if (count of notdone) is equal to 0 then
set notdone to jobnum
else
set notdone to notdone & ", " & jobnum
end if
end try
set joblist to the rest of joblist
end repeat
-----------------------------------------
-- ERROR
-----------------------------------------
if (count of notdone) is equal to 0 then
display dialog ("Your collects are finished")
else
display dialog ("Collect was NOT completed for:" & return & return & notdone & return & return & "You'll need to go back and figure out why, and then run collect on the individual job")
end if
-----------------------------------------
-- SUBROUTINES:
-----------------------------------------
on open_jobfile()
-----------------------------------------
-- Open Job Folder and Make Alias
-----------------------------------------
set openfilepath to ("VOLUMES:CLIENTS:" & jobnum & ":")
tell application "Finder"
make new alias file at desktop to folder jobnum of disk "CLIENTS" of application "Finder"
open result
-----------------------------------------
-- get names of all quark files starting with "k"
-----------------------------------------
set multi_file to (get every document file of front Finder window whose name extension is in {"qxd", "qxp"} and name starts with "k") as list
-----------------------------------------
-- sort finder window by last modified date
-----------------------------------------
set sortfile to sort multi_file by modification date
-----------------------------------------
-- check if there is more than one file.
-- if so, use the most-recently modified
-----------------------------------------
-- if (count of multi_file) is greater than 1 then
set multi_file to last item of mutli_file
-- end if
end tell
-----------------------------------------
-- open the job with Suppress Warnings
-----------------------------------------
tell application "QuarkXPress"
activate
open multi_file with Suppress All Warnings
delay 1
if not (exists project 1) then
delay 6
end if
-----------------------------------------
-- get the kcomm job number (to use for naming the "Final" folder
-----------------------------------------
tell layout space 1 of project 1
set kcn to name as string
end tell
return kcn
end tell
end open_jobfile
on close_file()
tell application "QuarkXPress"
close document 1 saving no
end tell
end close_file
on make_finfold()
-----------------------------------------
-- check for a pre-existing "FINAL" folder
-- if found, rename with "old"
-- then CREATE a new "FINAL" Folder
-----------------------------------------
tell application "Finder"
if exists (folder kcnfinfold of folder jobnum of disk "CLIENTS" of application "Finder") then
set name of (folder kcnfinfold of folder jobnum of disk "CLIENTS" of application "Finder") to (kcnfinfold & ".old")
end if
make new folder in front Finder window with properties {name:kcnfinfold}
end tell
end make_finfold
on do_collect()
-----------------------------------------
-- using system events, "collect" the opened quark file
-----------------------------------------
tell application "QuarkXPress"
activate
tell application "System Events"
tell process "QuarkXPress"
tell menu item "Collect for Output..." of menu 1 of menu bar item "File" of menu bar 1
click
delay 3
keystroke "s" using {command down}
delay 3
end tell
-----------------------------------------
-- wait for Collect Window to load
-----------------------------------------
try
with timeout of 5 seconds
repeat until window "Collect for Output" exists
end repeat
end timeout
end try
-----------------------------------------
-- browse to the correct "final" folder
-----------------------------------------
tell window "Collect for Output"
keystroke "G" using {command down}
delay 1
tell text field 1 of sheet 1 -- of window "Collect for Output"
keystroke collectpath -- this is "typed in" to the Go To Window
end tell
tell sheet 1 -- of window "Collect for Output"
click button "Go"
end tell
end tell
tell window "Collect for Output"
click button "Save"
end tell
-----------------------------------------
-- need this huge delay to allow for
-- the collect to happen in "real time"
-----------------------------------------
repeat until not (exists (window "Currently Collecting"))
end repeat
end tell
end tell
end tell
end do_collect
on print_cropmarkPDF()
-----------------------------------------
-- print a "with crops" pdf, directly to the "Final" Folder
-- slug line is NOT updated
-----------------------------------------
tell application "QuarkXPress"
if (exists layer "Non-Printing") of layout space 1 of project 1 then tell layer "Non-Printing" of layout space 1 of project 1
set properties to {suppress print:false, visible:true}
end tell
-----------------------------------------
-- PDF is printed using "PROXY" profile if the job can be identified as such
-- otherwise uses document default settings (this for tombstones etc)
-----------------------------------------
if kcn contains {"PC ", "NC ", "IC "} then
export layout space 1 of project 1 in (":Volumes:CLIENTS:" & jobnum & ":" & kcnfinfold & ":" & kcn & "_(WCR).pdf") as "PDF" PDF output style "kcomm_WCR_9.5x14"
else
export layout space 1 of project 1 in (":Volumes:CLIENTS:" & jobnum & ":" & kcnfinfold & ":" & kcn & "_(WCR).pdf") as "PDF"
end if
end tell
end print_cropmarkPDF
on stuff_collect()
-----------------------------------------
-- checks for pre-existing ".sitx" folder
-- renames "old" if exists
-----------------------------------------
tell application "Finder"
if exists (file (kcnfinfold & ".sitx") of folder jobnum of disk "CLIENTS" of application "Finder") then
set name of (file (kcnfinfold & ".sitx") of folder jobnum of disk "CLIENTS" of application "Finder") to (kcnfinfold & ".sitx" & ".old")
end if
if exists (file (kcnfinfold & ".sitx.old") of folder jobnum of disk "CLIENTS" of application "Finder") then
set name of (file (kcnfinfold & ".sitx") of folder jobnum of disk "CLIENTS" of application "Finder") to (kcnfinfold & ".sitx.old" & ".old")
end if
end tell
-----------------------------------------
-- stuffs the current collect
-- deletes the "final" folder it just stuffed.
-----------------------------------------
tell application "DropStuff"
set x to a reference to collectpath
set stufffin to stuff x
end tell
end stuff_collect
-----------------------------------------
-- copies the current ".sitx" collect to the:
-- T:/Typesetting/DF King/Collect folder
-----------------------------------------
on move_2_Collect()
set del_file to (":VOLUMES:CLIENTS:" & jobnum & ":" & kcnfinfold & ":")
set this_file to (":VOLUMES:CLIENTS:" & jobnum & ":" & kcnfinfold & ".sitx")
set Destination to (":VOLUMES:CLIENTS:Typesetting:COLLECT")
do shell script "cp -p " & quoted form of POSIX path of this_file & space & quoted form of POSIX path of Destination
-----------------------------------------
-- deletes the "final" folder and leaves the compressed (stuffed) file in the job folder
-----------------------------------------
do shell script "mv " & quoted form of POSIX path of del_file & space & trash
if (exists del_file) then
delay 7
end if
-- repeat until not (exists del_file)
-- end repeat
end move_2_Collect