Created
July 23, 2009 16:57
-
-
Save spjwebster/153230 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
-- activate screensaver | |
tell application "ScreenSaverEngine" to activate | |
set screensaver_running to true | |
set away_message to "Gone fishing" | |
-- pause itunes if running | |
tell application "System Events" to set iTunesRunning to (number of items in (processes whose name is "iTunes") is greater than 0) | |
if iTunesRunning then | |
tell application "iTunes" to pause | |
end if | |
-- set adium status and message if running | |
tell application "System Events" to set AdiumRunning to (number of items in (processes whose name is "Adium") is greater than 0) | |
if AdiumRunning then | |
tell application "Adium" | |
go away with message away_message | |
end tell | |
end if | |
-- set Colloquy status if running | |
tell application "System Events" to set ColloquyRunning to (number of items in (processes whose name is "Colloquy") is greater than 0) | |
if ColloquyRunning then | |
tell application "Colloquy" | |
repeat with conn in every connection | |
tell conn to set away message to away_message | |
end repeat | |
end tell | |
end if | |
-- wait for screen saver to quit | |
repeat while screensaver_running is true | |
delay 5 | |
tell application "System Events" to set screensaver_running to (number of items in (processes whose name is "ScreenSaverEngine") is greater than 0) | |
end repeat | |
-- restore Adium's state if running | |
if AdiumRunning then | |
tell application "Adium" | |
go available | |
end tell | |
end if | |
-- restore Colloquy's state if running | |
if ColloquyRunning then | |
tell application "Colloquy" | |
repeat with conn in every connection | |
tell conn to set away message to "" | |
end repeat | |
end tell | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment