Hi all,
The company I work for has three VPN access points globally. I've spent a bit of time trying to script the creation of these on new machines and have come to the conclusion that the only way I can do it is through GUI scripting. So I've written a script which you can find here - http://pastebin.com/NL5DTauF - as it's a bit long to put in an email.
This version of the script is about the 50th iteration of various combinations of moving the tell statements around and changing the position of the loop and stick "activate" in at random places. But I'm still hitting the same problem over and over.
The script successfully creates the London VPN access point and then, at this point
click button 1 of window "Network" of application process "System Preferences" click button "Apply" of sheet 1 of window "Network" of application process "System Preferences"
I get this in the log
click button 1 of window "Network" of application process "System Preferences" --> button 1 of window "Network" of application process "System Preferences" click button "Apply" of sheet 1 of window "Network" of application process "System Preferences" --> button "Apply" of sheet 1 of window "Network" of application process "System Preferences" end tell tell application "AppleScript Editor" activate end tell
And then, when the second loop starts, everything happens in the AppleScript Editor window - even when the first part of the loop (as it is now) is
tell application "System Events" activate tell window 1 of application process "System Preferences"
As I said, I've tried various combinations of the order of the tell statements and I've expanded the script out so the whole thing contains no embedded tell statements but still this "tell application applescript editor" appears at the end of the first loop and I can't figure out why.
Can anyone see what I'm missing?
Thanks
Steve |