Skip to content

Instantly share code, notes, and snippets.

@alunny
Created August 18, 2011 05:58
Show Gist options
  • Save alunny/1153401 to your computer and use it in GitHub Desktop.
Save alunny/1153401 to your computer and use it in GitHub Desktop.
have adium running while I'm at work
require 'rubygems'
require 'appscript' # using 0.6.1
adium = Appscript.app "adium"
return unless adium.is_running?
accnts = adium.accounts.get
work_accnt = accnts.find { |acc| acc.name.get == "[email protected]" }
now = Time.new
day = now.wday
weekend = day == 0 or day == 6
hour = now.hour
lunnys_time = hour < 9 || hour > 17
if weekend or lunnys_time
adium.go_offline work_accnt
else
adium.go_online work_accnt
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.alunny.adiumscript</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/ruby</string>
<string>/Users/alunny/bin/adiumscript.rb</string>
</array>
<key>StartInterval</key>
<integer>900</integer>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment