Toggle iTunes' window state with a keystroke

Mar 01, '04 10:06:00AM

Contributed by: jrcarroll

The hint http://www.macosxhints.com/article.php?story=20040208143120318&query=itunes got me thinking about how I might Zoom the iTunes window with only a keystroke. The following AppleScript will toggle the window between the big main window and the smaller control-only (or control-and-text) window.

Read the rest of the hint for the script.

Enter in the following in the Script Editor:


property BROWSER_WINDOW_LEFT : 2
property BROWSER_WINDOW_TOP : 22
property BROWSER_WINDOW_BOTTOM : 704

---------------------------------------

property okflag : false

-- check if iTunes is running
tell application "Finder"
  if (get name of every process) contains "iTunes" then ¬
    set okflag to true
end tell
if okflag then
  
  tell application "iTunes"
    
    if get minimized of browser window 1 is true then
      set minimized of browser window 1 to false
      set position of browser window 1 to ¬
        {BROWSER_WINDOW_LEFT, BROWSER_WINDOW_TOP}
          else if get minimized of browser window 1 is false then
      set minimized of browser window 1 to true
      set position of browser window 1 to ¬
        {BROWSER_WINDOW_LEFT, BROWSER_WINDOW_BOTTOM}
          end if
    
  end tell
  
end if
I make it executable from anywhere in the system by assigning it a keystoke in Youpi Key.

[robg adds: Youpi Key is now iKey, a $20.00 shareware package.]

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040222030924511