Hopefully that munged up subject enticed you here. I’m attempting to write a Applescript that uses the gui controls in Internet Connect to configure an 802.1x connection. In fact, I’ve done it… except for one part at the very end where a “Verify Certificate” window/dialog comes up and I need to click continue. You see, I can’t seem to access the window through Applescript and UI Element Inspector doesn’t show any information on it. (Screenshot!: https://webdrive.service.emory.edu/users/jmaxwel/pub/no_info_on_window.png) This mysterious window seems to be connected with process “eaptlstrust”.
Could someone give me some advice on how I could maniupulate this problematic little window/dialog?
Thanks in advance!
john
Model: MacBook Pro (but all models AFAIK)
AppleScript: 10.4.6?
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)
Model: MacBook Pro (but all models AFAIK)
AppleScript: 10.4.6?
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)
try “show certificate” and probe around? Just a thought. In safari, it gives you a "trust/don’t trust dialog. that might be available on the certificate.
Wait… what? I appreciate the feedback, but could you flesh that out some? I’m trying to figure out where we’re not connecting…
thanks,
john
“Continue” is the default button - did you try this?
keystroke return
That’s a good thought, but how can I direct it to that window/dialog?
thanks,
john
According to your screen shot, that dialog is owned by Finder, so I think putting this in the script after the dialog is triggered - but within the block that triggers it - will work:
tell application "System Events" to tell process "Finder"
keystroke return
end tell
EDIT: You might need a delay to allow the dialog to appear before the keystroke.
Ah, sorry I wasn’t more specific about the failure of the UI Element Inspector to give information about the window. The Finder details in the picture are just because that was what I had moused over before the mousing over the certificate window. If I mouse over System Prefs and then over to the Verify Certificate window, then it will hold the details for System Preferences. In fact, I’ve attempted your suggestion previously, hoping that maybe Finder would be defacto parent of the window, but that doesn’t appear to be the case.
Thanks for the suggestion though. Anything else come to mind?
john
Keystroke return seems to be the obvious choice, but that doesn’t mean much. Did you try Activity Monitor to try to pin down the process that runs during that dialog? But without seeing the script, I can’t think of a solution (and maybe not even then.
)
j
EDIT: Is it Keychain Access? That just occurred to me. Maybe because I don’t pay much attention to it.
Yes, it’s running as /System/Library/PrivateFrameworks/EAP8021X.framework/Support/eaptlstrust.app
Also, when I give the window/dialog focus, the Apple menu doesn’t recognize that’s it’s any different than whatever application had focus previously. What do you think it is? A dialog? A window?
thanks,
john
I found eaplstrust.app - it’s not scriptable, so I don’t know that
tell application System Events" to tell process "eapltltrust"
keystroke return
end tell
will work, but why not give it a go?
Another possibility is instead of scripting the window by name, script to the frontmost window or window whose floating is true for a GUI solution - see post #7 of this thread for an example of how to do that. Maybe it will help.
http://bbs.applescript.net/viewtopic.php?id=17813
Okay, great. The above works, if I first “set frontmost to true” before doing the “keystroke return”. I think previously when I had tried doing that, the keystrokes were just disappearing into whatever was in the foreground. That’s a great help, but here’s the deal: I really need to interact with this window. I need to be able to click “Show Certificate” and then mess with some other controls so that the user’s computer will always trust our certificates and the user will never see those settings when they connect to the access point. Neither tab nor the arrow keys seem to allow me to navigate any of the controls on that dialog/window. Is there some other arcane magic I could weave over it? 
thanks a bunch,
john
Oh, heck. I thought all you wanted to do was click return. Well at least that works.
Are you just using “…set frontmost to true” or did you use “…tell process eaptitrust…” as well? Posting even a small portion of your script would help.
Some variation of telling the frontmost window to tell "button whose name is “Show Certificate” to click might work. The thread I mentioned also has an example of using a repeat loop to find a particular button. That might be useful in this case.
There is an option in System Preferences>Keyboard & Mouse>Keyboard Shortcuts>Full Keyboard Access to use Tab to move the keyboard focus between all controls. If “All controls” is checked (more scripting?) you could “keystroke tab” but since “Continue” is the default button, I think “return” might still click that.
This is what currently works to click the “Continue” button:
tell application "System Events" to tell process "eaptlstrust"
set frontmost to true
keystroke return
end tell
This gives me a “System Events got an error: NSReceiverEvaluationScriptError: 4”:
tell application "System Events" to tell process "eaptlstrust"
set frontmost to true
click button "Continue"
end tell
As does this:
tell application "System Events" to tell process "eaptlstrust"
set frontmost to true
click button 1
end tell
And so does this:
tell application "System Events" to tell process "eaptlstrust"
set frontmost to true
click button "Show Certificate"
end tell
Nothing happens when I do this:
tell application "System Events" to tell process "eaptlstrust"
set frontmost to true
keystroke tab
end tell
I’m beginning to wonder if this is attempting the impractical, if not impossible. Or maybe I just don’t know enough to solve this.
You checked “All controls” first, correct? If it had worked in your script, one of the other buttons would have gotten a blue halo.
With this page open, run this - repeatedly. At least you’ll see what is does. If the page doesn’t scroll, look at all the buttons and the fields.
tell application "Safari" to activate
tell application "System Events" to tell process "Safari"
keystroke tab
end tell
As for the error, a repeat loop might work, something like:
repeat with buttons of window 1--or maybe first window whose description is "floating window"
if (button "Show Certificate" exists) then
click button "Show Certificate"
exit repeat
end if