if appIsRunning("Caffeine") then
tell application "Caffeine"
if active then
turn off
if appIsRunning("Skype") then
tell application "Skype"
send command "SET USERSTATUS away" script name "Kaffe"
end tell
end if
if appIsRunning("Adium") then
tell application "Adium"
go away
end tell
end if
if appIsRunning("iChat") then
tell application "iChat"
set status to away
end tell
end if
else
turn on
if appIsRunning("Skype") then
tell application "Skype"
send command "SET USERSTATUS online" script name "Kaffe"
end tell
end if
if appIsRunning("Adium") then
tell application "Adium"
go available
end tell
end if
if appIsRunning("iChat") then
tell application "iChat"
set status to available
end tell
end if
end if
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
if appIsRunning("Caffeine") then
tell application "Caffeine"
if active then
turn off
set kaffeOn to "false" (*kaffen var på*)
else
turn on (*for 1800*)
set kaffeOn to "true" (*kaffen er på*)
end if
end tell
end if
if appIsRunning("Skype") then
tell application "Skype"
set status to send command "get userstatus" script name "Kaffe"
if status is not "USERSTATUS OFFLINE" then
if status is not "USERSTATUS AWAY" and kaffeOn then
send command "SET USERSTATUS away" script name "Kaffe"
else if status is not "USERSTATUS ONLINE" and kaffeOn is not "true" then
send command "SET USERSTATUS online" script name "Kaffe"
end if
end if
end tell
end if
(*
tell application "Script Editor"
display dialog kaffeOn
end tell
*)
if appIsRunning("Adium") and status is not "USERSTATUS OFFLINE" then
tell application "Adium"
if kaffeOn is "true" then
go away
else
go available
end if
end tell
end if
if appIsRunning("iChat") then
tell application "iChat"
set status to away
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
Registrerte brukere: Google [Bot]