Skip to content

Instantly share code, notes, and snippets.

@andrewh
Last active December 15, 2025 19:47
Show Gist options
  • Select an option

  • Save andrewh/7135352 to your computer and use it in GitHub Desktop.

Select an option

Save andrewh/7135352 to your computer and use it in GitHub Desktop.

Revisions

  1. andrewh revised this gist Oct 24, 2013. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions anyconnect.scpt
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,9 @@
    -- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
    -- 2. Open Security & Privacy System Preferences, go to Privacy, Accessibility
    -- 3. Enable Applescript Editor and System UI Server
    -- 4. Trigger script from the menu
    -- 5. Enjoy being connected
    -- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password
    -- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
    -- 4. Enable Applescript Editor and System UI Server
    -- 5. Trigger script from the menu
    -- 6. Enjoy being connected

    tell application "Cisco AnyConnect Secure Mobility Client"
    activate
  2. andrewh revised this gist Oct 24, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions anyconnect.scpt
    Original file line number Diff line number Diff line change
    @@ -11,8 +11,8 @@ repeat until application "Cisco AnyConnect Secure Mobility Client" is running
    delay 1
    end repeat
    tell application "System Events"
    repeat until (window 1 of process "Cisco AnyConnect Secure Mobility Client" exists)
    delay 1
    repeat until (window 1 of process "Cisco AnyConnect Secure Mobility Client" exists)
    delay 1
    end repeat
    tell process "Cisco AnyConnect Secure Mobility Client"
    keystroke ("vpn.example.com" as string)
  3. andrewh revised this gist Oct 24, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion anyconnect.scpt
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    -- 5. Enjoy being connected

    tell application "Cisco AnyConnect Secure Mobility Client"
    activate
    activate
    end tell
    repeat until application "Cisco AnyConnect Secure Mobility Client" is running
    delay 1
  4. andrewh created this gist Oct 24, 2013.
    28 changes: 28 additions & 0 deletions anyconnect.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    -- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
    -- 2. Open Security & Privacy System Preferences, go to Privacy, Accessibility
    -- 3. Enable Applescript Editor and System UI Server
    -- 4. Trigger script from the menu
    -- 5. Enjoy being connected

    tell application "Cisco AnyConnect Secure Mobility Client"
    activate
    end tell
    repeat until application "Cisco AnyConnect Secure Mobility Client" is running
    delay 1
    end repeat
    tell application "System Events"
    repeat until (window 1 of process "Cisco AnyConnect Secure Mobility Client" exists)
    delay 1
    end repeat
    tell process "Cisco AnyConnect Secure Mobility Client"
    keystroke ("vpn.example.com" as string)
    keystroke return
    end tell
    repeat until (window 2 of process "Cisco AnyConnect Secure Mobility Client" exists)
    delay 1
    end repeat
    tell process "Cisco AnyConnect Secure Mobility Client"
    keystroke ("redacted" as string)
    keystroke return
    end tell
    end tell