Skip to content

Instantly share code, notes, and snippets.

@okada-takuya
Created December 2, 2014 14:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okada-takuya/b69bf818d08e2f24cec9 to your computer and use it in GitHub Desktop.
Save okada-takuya/b69bf818d08e2f24cec9 to your computer and use it in GitHub Desktop.
on idle {}
set SSID to current_SSID()
if SSID contains "HOME-SSID" then
if application "TogglDesktop" is running then
tell application "TogglDesktop" to quit
display notification "Connect " & SSID & " and stop toggl client" with title "toggle_toggl.scpt"
end if
else if SSID contains "OFFICE-SSID" then
if application "TogglDesktop" is not running then
tell application "TogglDesktop" to activate
display notification "Connect " & SSID & " and run toggl client" with title "toggle_toggl.scpt"
end if
end if
return 5 * minutes --5分毎に実行する
end idle
on current_SSID()
return do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"
end current_SSID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment