Created
November 14, 2017 05:36
-
-
Save raffylopez/dd2b7226d30f0a31a1e80b1430c18a04 to your computer and use it in GitHub Desktop.
OS X Connection Monitor (AppleScript) -- Requires AnyBar
This file contains hidden or 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
use AppleScript version "2.4" -- Yosemite (10.10) or later | |
use scripting additions | |
property imageName : "red" | |
property delayValue : 20 | |
property googleURL : "http://www.google.com" | |
on run | |
set imageName to "white" | |
end run | |
on idle | |
if (count (get ((googleURL as URL)'s host & {dotted decimal form:""})'s dotted decimal form)) > 0 then | |
set imageName to "black" | |
else | |
if imageName is "black" then | |
set imageName to "question" | |
set delayValue to 2 | |
else if imageName is "question" then | |
set imageName to "white" | |
set delayValue to 60 | |
end if | |
end if | |
tell application "AnyBar" to set image name to imageName | |
return delayValue | |
end idle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment