8
3
I have an Applescript in which I wish to set the value of the text fields Name
and Password
of a window belonging to the process SecurityAgent
.
It is similar to the following:
tell window "Authenticate" of process "SecurityAgent"
tell group 1
set value of text field 1 to "king"
set value of text field 2 to "king1"
end tell
click button "OK" of group 2
end tell
While my script is also referring to the process SecurityAgent
, the window in question is the one that pops up when you shut down OS X, and another user is logged in. The SecurityAgent
window pops up asking for the administrator username and password in order to complete the shut down process. I do not know how to refer to the text fields in said window.
My question is, how do I find out the name of these text fields, the group they belong to, and the window they belong to? Is there a method of mapping OS X windows so I can refer to them in the AppleScript? I can't seem to find information concerning this anywhere.
1+100 for letting me know about UIElementInspector – Nifle – 2011-10-15T22:29:20.057
@slhck - Wow! What a fantastic answer. It is very much appreciated, and I will get to work right away on this. Curious however, as I'm new to AppleScript in general; How would I make the
UI elements
commands? – stefmikhail – 2011-10-15T22:35:35.5401@Stef Well, for example
UI Elements of window "Authenticate" of process ...
. Just do this in AppleScript editor and look at the results at the bottom. I unfortunately haven't found a more efficient way to do this though. – slhck – 2011-10-15T23:00:20.067@slhck - No no that sounds perfect. And ends up UI Browser offers a one month full feature trial, so I'll be able to give that a go as well. Again, thanks a bunch. – stefmikhail – 2011-10-16T00:29:49.940
@stefmikhail Sure, no problem! Let me know how UI Browser works for you, haven't had the time yet to try it! – slhck – 2011-10-16T08:32:07.750