Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tell application "System Events"
- set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
- end tell
- set wlanssid to do shell script "networksetup -getairportnetwork en1 | cut -c 24-"
- connectVPN(wlanssid)
- if isRunning then
- sendGrowl("VPNCONNECT", "Connecting VPN", wlanssid)
- end if
- on connectVPN(SSID)
- tell application "System Events"
- tell current location of network preferences
- local VPNService
- if (SSID = "XXXXXXXXXX") then --WLAN Name
- set VPNService to service "XXXXXXX-VPN" -- VPN Name
- set isConnected to connected of current configuration of VPNService
- if not isConnected then
- connect VPNService
- end if
- end if
- end tell
- end tell
- end connectVPN
- on sendGrowl(growlName, growlTitle, growlDescription)
- try
- tell application "GrowlHelperApp"
- set the allNotificationsList to {growlName}
- set the enabledNotificationsList to {growlName}
- register as application ¬
- "Show " & growlName all notifications allNotificationsList ¬
- default notifications enabledNotificationsList ¬
- icon of application "Network Utility"
- notify with name growlName ¬
- title growlTitle ¬
- description growlDescription ¬
- application name "Show " & growlName
- end tell
- on error growlError
- display dialog "Growl Error:" & return & growlError
- end try
- end sendGrowl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement