Just to keep everyone up to date, and in the hope that someone might have the answer to this, I’ve also been posting on the Graphicconverter Yahoo Groups forum.
I’ve managed to define the default printer, but when I try and print direct from GraphicConverter, with the show print dialog set to no, the item prints, but from the first printer in the System Preferences printer list, not the default.
If I set the show print dialog to yes, the print dialog freezes, and only responds to physical clicks, and is not scriptable.
property theLargePagePrinter : "Large Page Printer"
property theSmallPagePrinter : "A4 Printer"
# Presume the default printer is set to 'A4 Printer'
set printerName to ""
set p to 2
set tempPrinterName to my theLargePagePrinter as text
set p to 3
repeat with x from 1 to (count of tempPrinterName)
if character x of my tempPrinterName is not " " then
set printerName to printerName & (character x of tempPrinterName) as text
else
set printerName to printerName & "_" as text
end if
end repeat
set defaultPrinterProperties to do shell script ("lpoptions -d " & printerName)
try
tell application "GraphicConverter 9"
activate
# Using 'print dialog no' doesn't work, still uses first listed printer
# Using 'print dialog yes', chooses correct printer, but printer sheet freezes unless 'Print' is physically clicked, and clicking 'Cancel' gives a 'GraphicConverter 9 got an error:AppleEvent handler failed' error
print document 1 print dialog yes
print document 1 with properties {target printer:(theLargePagePrinter)} print dialog yes
say 1
activate
tell application "System Events" to tell process "GraphicConverter 9"
keystroke return
end tell
end tell
on error errmsg
display dialog errmsg
end try