Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Add Printer via UI scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add Printer via UI scripting



Hi Brian,
Thanks, I too am running Snow Leopard, however that doesn't seem to solve the issue I am having :(

any other ideas?

thanks
David


On Sep 26, 2009, at 8:35 PM, Brian Christmas wrote:

G'day David

I've tried your script on my Snow Leopard intel iMac, and the script opens "AddPrinter" just fine. It just crashes on the click pop up button 1 line probably cause the GUI is different.

On a slower box you might need to check that "Add Printer" is actually open.

tell application "Finder"
repeat until exists process "AddPrinter"
end repeat
end tell

HTH

Regards

Santa


On 27/09/2009, at 8:07 AM, David Kahn wrote:

Hello all, 

I have been racking my head to figure this out.   Below is my script that should add a printer, however when I first run the script it gets caught up on a text field, if i run the script a second time with the Add Printer window open it works!

-- Set printers via ARD from AppleScript
-- Created by that dude David Kahn <email@hidden>

tell application "AddPrinter" to activate
tell application "System Events" to tell process "AddPrinter"
set address to "143.143.143.143" -- printer ip address variable
set printername to "Some Laser Printer" -- Printer name varaible
set printerlocation to "Some Lab" -- Printer Location

-- Set Protocol:
tell group 1 of window "Add Printer"
tell group 2
click pop up button 1
click menu item "Internet Printing Protocol - IPP" of menu 1 of pop up button 1
click combo box 2
end tell

keystroke (address-- sets ip address from address variable
keystroke tab
keystroke tab
delay 5
keystroke (printername-- sets printer name
keystroke tab
keystroke (printerlocation-- sets location of printer
delay 5

end tell

-- Add Printer
tell window "Add Printer"
click button "add"
end tell
delay 4
tell sheet 1 of window "Add Printer"
tell group 1 of group 1
click button "Continue"
end tell
end tell
end tell


Any help will save me from finishing a bottle of Captain Morgan's

thanks in advance.

-David Kahn

Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users This email sent to email@hidden
References: 
 >Add Printer via UI scripting (From: David Kahn <email@hidden>)
 >Re: Add Printer via UI scripting (From: Brian Christmas <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.