• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Add Printer via UI scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add Printer via UI scripting


  • Subject: Re: Add Printer via UI scripting
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 27 Sep 2009 10:35:19 +1000

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
  • Follow-Ups:
    • Re: Add Printer via UI scripting
      • From: David Kahn <email@hidden>
References: 
 >Add Printer via UI scripting (From: David Kahn <email@hidden>)

  • Prev by Date: Re: AS Application
  • Next by Date: Re: Add Printer via UI scripting
  • Previous by thread: Add Printer via UI scripting
  • Next by thread: Re: Add Printer via UI scripting
  • Index(es):
    • Date
    • Thread