|
| 04. Use iTunes visualizer as Screen saver |
This task shows iTunes visualizer instead of Screen saver, when iTunes is playing a music.
(Trigger)
1. Watch Application
Input "ScreenSaverEngine" and select "changes active", not "is launched". The app is located at
/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app
(Action)
1. Run Applescript
Input following script.
property idleTime : 10 -- Interval time to sleep in minutes, 0 is not to sleep
on run
tell application "System Events"
set processList to name of every application process
end tell
if processList contains "iTunes" then
tell application "iTunes"
if player state is playing then
try
tell application id "com.apple.ScreenSaver.Engine" to quit
end try
activate
--set minimized of window 1 to false
set full screen to true
set visuals enabled to true
my sleepRun()
end if
end tell
end if
end run
on sleepRun()
if idleTime is 0 then return
repeat with i from 1 to idleTime
delay 60
tell application "System Events" to set currentApp to (name of the first process whose frontmost is true)
if currentApp is not "iTunes" then
return
else
tell application "iTunes"
if visuals enabled is false then return
end tell
end if
end repeat
--tell application "iTunes" to set full screen to false
tell application "iTunes" to set visuals enabled to false
tell application "System Events" to sleep
end sleepRun
This script terminates ScreenSaver when it becomes active and starts iTunes visualizer. Then if the visualizer runs for 10 minutes (this duration can be changed at first line of script), it stops the visualizer and let computer sleep.
|
|
|