We’re using GraphicConverter to print 90% of 200-300 files per day, and I’ve written a script to choose between different paper sizes on different printers.
Trouble is, GC doesn’t seem to have a direct-from-script printing that allows you to choose printer presets. So I’m trying to GUI the dialog boxes.
The ‘OK’ button on the initial dialog box doesn’t respond to clicks in any form, nor a keystroke return.
Thorsten Lempke says it’s Apples fault, and Apple told me GUI is the last refuge of the desperate! Well, I’m desperate!
Does anyone have ANY ideas on how I might click that darn button.
activate application "GraphicConverter"
PrintGraphicConverter()
on PrintGraphicConverter()
tell application "System Events"
tell process "GraphicConverter"
delay 1
keystroke "p" using {command down}
delay 1
keystroke (ASCII character 3) -- or keystroke (ASCII character 32) -- or keystroke return
delay 1
keystroke (ASCII character 3)
end tell
end tell
end PrintGraphicConverter
Tom
Browser: Safari 523.10.6
Operating System: Mac OS X (10.5)
thanks, that worked. Turns out I hadn’t put in a long enough time delay. I was actually testing for the presence of the dialog box then immediately trying to press the button with return. The 1 second delay fixed it.
Santa, I don’t use Graphic Converter very much (only to open stubborn files) but when I had a quick look at your problem I clicked a preference in Print and can no longer get that dialog back. I have no idea if doing the same would work for you? Might be easier than GUI scripting its dismissal. or do you intend to set some options?
Hi Santa, The script I posted works for me on Tiger & Leopard.
I increased the delays – see if this code works for you now.
activate application "GraphicConverter"
PrintGraphicConverter()
on PrintGraphicConverter()
tell application "System Events"
tell process "GraphicConverter"
delay 1
keystroke "p" using {command down}
delay 2
keystroke (ASCII character 32)
delay 2
keystroke (ASCII character 32)
end tell
end tell
end PrintGraphicConverter
First rule of UI scripting for me…“delay” is your friend.
What I find works well is use a variable for “delay” to make it easier to make sweeping changes. I go a step farther sometimes have three variables…one for a short delay, medium delay, and long delay.