I’m trying to automate the process of connecting to a Cisco VPN and mounting multiple volumes. What i have almost satisfies me, but there’s a minor problem:
I need to enter a password and press the “OK” button. I do that with the clipboard and return key. However, after “keystroke return”, the application does a jumpy minimization and expansion that leaves the same window open with the password entry blank and no VPN connection being made. It’s more like “return” was an “undo”.
tell current application
set the clipboard to "[password]"
end tell
tell application "VPNClient"
activate
end tell
--The app opens a window with username present and the cursor on the password entry area
delay 0.2
--paste password
tell application "System Events"
set frontmost of process "VPNClient" to true
keystroke "v" using command down
keystroke return
end tell
--the app immediately makes its jumpy moves
delay 4
--the following works great and is based on the passwords already being in the keychain
tell application "Finder"
mount volume "smb://username1@server/volume"
mount volume "smb://username2@server/volume"
end tell
So how can i make the “ok” work better?
Thanks!
Model: MacBook Pro
AppleScript: 2.0.1
Browser: Firefox 3.5.2
Operating System: Mac OS X (10.5)