Skip to content

Instantly share code, notes, and snippets.

@kevinberny
kevinberny / Screen Shot Setup
Last active January 4, 2016 01:09
MacOS X script to setup a desktop folder for all new screen shots and to move existing Screen Shots to this folder. Created for a coworker and wrapped in an app
tell application "Finder"
set p to path to desktop -- Or whatever path you want
make new folder at p with properties {name:"ScreenCaps"}
end tell
do shell script "defaults write com.apple.screencapture type -string png"
do shell script "defaults write com.apple.screencapture disable-shadow -boolean-neg"
do shell script "defaults write com.apple.screencapture location ~/Desktop/ScreenCaps"
tell application "System Events"
move (every file of desktop folder whose name starts with "Screen Shot") to "~/Desktop/ScreenCaps"
@kevinberny
kevinberny / VPN_wireless_disable
Created January 21, 2014 19:15
Disconnect Cisco Anyconnect VPN client and disable wireless (used when Ethernet is enabled at the office
do shell script "networksetup -setairportpower en0 off"
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
@kevinberny
kevinberny / AnyConnect_SecurID
Last active May 4, 2023 10:58
Mac OS X AppleScript to automate RSA SecurID pin & Cisco AnyConnect client connection. Leverages keychain. Cobbled together from several other previous postings
set the clipboard to ""
set appname to "SecurID"
set thePin to RsaTokenPin()
activate application appname
do shell script "networksetup -setairportpower en0 on"
tell application appname
activate