Dear All,
I know this has been covered before and I think I have read all the threads on the subject, but I am still getting error messages when I try and use some of the various sort routines I have “stolen” from this site
My script is for Finale 2004c (which has no Applescript support) it is as below.
I have two problems;
-
The files seems to print in a completely random order, ideally they would print in the order they are in the Finder Window or even better by being sorted against a custom sort list (probably out of my “comfort zone”). I have tried but got various error messages, my guess is a “coercion” problem?
-
Is there a way using UI scripting to know when an application has printed a document and is “idle”, at the moment I have to add a delay at the end of the routine. This is fine except if the document takes longer to print than the delay, the routine print one document over and over (very bad!)
As I am sure you can tell, this is all new to me, so any help or pointers to more information would be gratefully received.
Regards
David Hage
Dakota Music Ltd
– start Finale 2004c if it is not already running
tell application “Finale 2004c”
activate
end tell
–tell finder to set selected file(s) droppped on it to variable MyFileList
tell application “Finder”
set MyFileList to the selection
end tell
– this is the start of the repeat for the printing of each file
–open print dialog and press print for selected files
repeat with MyFile in MyFileList
open MyFile – this’ll tell finder to open in the default app for the file type
tell application “System Events”
–bring Finale 2004c to front
set frontmost of process “Finale 2004c” to true
tell process “Finale 2004c”
– this section opens page setup and chooses a paper size
–open page setup
click menu item “Page Setup…” of menu “File” of menu bar item “File” of menu bar 1
delay 1
click pop up button 2 of UI element 1 of UI element 4 of window “Page Setup”
– this selects the Kyocera as the “Format for” printer to prevent losing bottoms of pages
delay 0.2
keystroke “Kyo”
keystroke return
delay 0.5
–click A4 and press return
click pop up button 1 of UI element 1 of UI element 4 of window “Page Setup”
delay 0.2
–choose paper size here
keystroke “A4”
delay 0.2
keystroke return
–click portrait button is radio button 3
click radio button 3 of radio group 1 of UI element 1 of UI element 4 of window “Page Setup”
–close page setup
keystroke return
end tell
end tell
delay 0.5
–This section brings up print dialogue and selects the Finale 2004c settings
tell application “System Events”
set frontmost of process “Finale 2004c” to true
tell process “Finale 2004c”
keystroke “p” using {command down}
delay 1.5
–bring up Finale 2004c print menu
click pop up button 1 of window “Print”
–Select Finale 2004c settings
keystroke “Fin”
keystroke return
delay 0.5
– this clicks the one-up button
click radio button “1-up” of UI element 1 of UI element 3 of window “Print”
– print the file
keystroke return
end tell
delay 7
end tell
– this ends the repeat section
end repeat
end open