Skip to content

Instantly share code, notes, and snippets.

@raffylopez
Created November 14, 2017 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raffylopez/dd2b7226d30f0a31a1e80b1430c18a04 to your computer and use it in GitHub Desktop.
Save raffylopez/dd2b7226d30f0a31a1e80b1430c18a04 to your computer and use it in GitHub Desktop.
OS X Connection Monitor (AppleScript) -- Requires AnyBar
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