knowing if a printer is connected

BNig niggemann at uni-wh.de
Thu Nov 19 18:45:59 EST 2009


Peter,

to test this put this applescript into a field 1 and have a field 2 for the
result

---------------------
tell application "Printer Setup Utility"
	set tReturn to ""
	set x to name of every printer as list
	repeat with i from 1 to count of items of x
		set tReturn to tReturn & item i of x & tab
		set tReturn to tReturn & item -1 of (properties of printer (item i of x)
as list) & linefeed
	end repeat
	return tReturn
end tell
----------------

put this into a button
--------------------------
on mouseUp
   do field 1 as applescript
   put char 2 to - 3 of  the result into field 2 -- gets rid of quotes and
trailing linefeed
end mouseUp
--------------------
so basically you let applescript return the value/s you are interested in
and you check the result.
The last item of the properties of a printer is the status, it unfortunately
returns idle. At least you get the names of the printers. The current
printer is the default printer.
regards
Bernd



Peter Brigham MD wrote:
> 
> It returns "idle" in all cases? Are you saying that it doesn't  
> distinguish if the printer is on/connected vs off/disconnected?
> 
> How would I get the contents of the various printer properties from  
> this script into rev variables to test this out? Do I use an 'on  
> appleEvent' handler -- if so, how? Sorry for the naive questions, but  
> I haven't used applescript much.
> 
> -- Peter
> 
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
> 

-- 
View this message in context: http://n4.nabble.com/knowing-if-a-printer-is-connected-tp624188p624321.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list