| 17. Show iTunes mini player at background |
This task minimizes the iTunes browser window when iTunes becomes inactive, then vice versa, shows large browser window when iTunes becomes active.
<Task1>
This task shows iTunes browser when it becomes active.
(Trigger)
1. Watch Application
Input "iTunes" and "becomes active".
(Action)
1. AppleScript
Input following script.
tell application "iTunes"
repeat with aWindow in browser windows
set minimized of aWindow to false
end repeat
end tell
<Task2>
This task minimizes iTunes browser when it becomes inactive
(Trigger)
1. Watch Application
Input "iTunes" and "becomes inactive".
(Action)
1. AppleScript
Input following script.
tell application "System Events" to set appList to name of every application process whose background only is false
if appList contains "iTunes" then
tell application "iTunes"
repeat with aWindow in browser windows
set minimized of aWindow to true
end repeat
end tell
end if
P.S.
On my environment, iTunes doesn't remember the position of windows. So I added a script to set position of window.
Maximize
tell application "iTunes"
repeat with aWindow in browser windows
set the minimized of aWindow to false
set position of browser window 1 to {258, 147}
end repeat
end tell
Minimize
tell application "System Events" to set appList to name of every application process whose background only is false
if appList contains "iTunes" then
tell application "iTunes"
repeat with aWindow in browser windows
set the minimized of aWindow to true
set position of aWindow to {907, 699}
end repeat
end tell
end if
|