printing from Safari

Hi, I’ve been looking into this for a while now, and can see that printing from Safari is problematic. However, I need to do it. I’m writting a script that will automatically process orders taken on our website. The script logs in, tabs and keystrokes its way through the process, selects the ‘print this invoice link’ … then comes the following:

tell application “System Events”
tell process “Safari”
keystroke “P” using (command down)
delay 4
keystroke return
end tell
end tell

The print window appears, the button gets clicked and the print window goes away again, but nothing gets printed.

Any ideas?

Cheers,

Kev.

Ah Ha. sorry I see what it’s doing, it’s ring up the page setup dialog, not the print dialog. Mmmmmmm …

Got it. using upper case P brings up the page setup dialog, but using lower case P brings up the print dialog! whodathunkit?

Cheers anyway.

Kev.