Badly need help GUI script print dialog in GraphicConverter

G’day scripters.

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.

Regards

Santa

I hope this helps…

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)

G’day Tom

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.

The button still won’t accept a click though.

Regards

Santa

Hi Santa,

Would you please tell us exactly what button in GraphicConverter won’t accept a click.

Tom

Operating System: Mac OS X (10.5)

G’day Tom

The ‘OK’ button in the first print dialog box (titled 'Print Options)

Sorry about the delay, but my ‘Subscribe to this topic’ does not work, and I have to check my topics manually

Regards

Santa

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

Good luck!

Tom

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.

My first rule is: Control the UI elements, don’t let them control you

that means, instead of using “random” delays, ask and wait for specific states of UI elements :wink: