Skip to main content
Question

Anyone done any UI scripting? Stuck on AppleScript UI scripting


RobertHammen
Forum|alt.badge.img+28

Hi folks,

I'm trying to deploy a .networkConnect (VPN) profile for 10.6 users (I have 5 already, LOL). I am working on an AppleScript which imports the profile, prompts the user for their network account name, enters it into the Account Name field, hits the Apply button, and then deletes the .networkConnect document from their disk.

I have everything working except for entering the data into the "Account Name:" field in System Preferences->Network->VPN.

Network isn't AppleScript-aware enough for me to do something like below. Here's the relevant snippet of my script:

set AccountName to the text returned of (display dialog "What is Your Account Name?" default answer "")
tell application "System Preferences" to set current pane to pane "com.apple.preference.network"
tell application "System Events" to tell process "System Preferences" to tell window "Network"
set contents of text field 2 to AccountName (this doesn't work)
click button "Apply"
end tell

I have the UI Accessibility Inspector, but I've Googled and can't find an example of how to put text into that field, other than the "keystroke" commands, which don't seem to work.

Looking for ideas/help from anyone who may have done something similar...

Thanks,

--Robert

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings