Why do I get this error?

Hi folks

I have written a test application which gets a list of the installed printers and drops them into a popup button, but I get this error during app start up:

Printer Setup Utility got an error: Connection is invalid. (-609)

I click OK.
The app opens.
Same error message again.
Print Setup Utility opens and the list populates.
Print Setup Utility closes.

All good!

Why do I get this error or how could I stop it. I assume it is because there is a time lag between Print Setup Utility opening and the request for data.

Is there a neater way to get this info?

	tell application "Printer Setup Utility"
		open
		set myList to name of printers
		quit
	end tell

Thanks.
S

Hi,

you can open documents, but applications should be launched or activated.
Just omit the open line, it’s not needed


tell application "Printer Setup Utility"
	set myList to name of printers
	quit
end tell

Stefan

Still does it!!

Next idea?

S

does this work for you


set myList to paragraphs of (do shell script "lpstat -a | cut -d ' ' -f 1 | tr _ ' '")

Yay Yay!

It does however pull up and extra printer with a name “_10.1.5.57”.

Would this be a printer defined in CUPS?

S

could be. Do you need this printer?

If you want to delete it, you can only do this in the shell (with lpadmin)

OK. Thats cool.

Thanks(again) for your help.

S