Created
December 2, 2014 14:41
-
-
Save okada-takuya/b69bf818d08e2f24cec9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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