Applescript click into text field
Hello,
I've just started learning AppleScript and my first task is to install a network printer after the pkg has already been installed (no ppd file available). Here's my script so far:
tell application "AddPrinter" to activate
tell application "System Events"
tell process "AddPrinter"
tell window 1 -- or “window 1”
click button "IP" of toolbar 1 -- or “button 3”
tell group 1 of group 1
delay 1
keystroke ip_address
end tell
delay 1
tell group 2 of group 1
set value of text field 1 to copier_name
set value of text field 2 to copier_location
end tell
end tell
end tell
end tell
I'm having an extra hard time getting the script to click in the Address field of the window. It simply "dings" and moves on, or I should say it does nothing. If I set delay to 4 seconds or something to give me some time and manually click the Address field then the script will continue. I've tried set focused of text field 1 to true, that did not work, I've tried click as well, that did not work either. How do I put the mouse cursor in that field so keystroke would work?
Thank you!
iMac (24-inch Early 2008), OS X El Capitan (10.11.1), null