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
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
thanks in advance.