How do I force QuickTime to open on a second monitor?

When I launch a movie in QuickTime I'd like for it to always open up on my second display (not the default primary one). I'm actually opening the movie via AppleScript from iTunes so an applescript solution would be OK.

There used to be a preference setting in Quicktime that would let you default it to a particular display but that seems to have been lost with QuickTime X.


Solution 1:

OK, so I went ahead and captured the bounds of the window placed in the middle of my second screen and just added a line in my AppleScript to push the new window there every time.

tell application "iTunes"
    set sel to item 1 of selection
    set loc to (get location of sel)
end tell

tell application "QuickTime Player"
    open loc
    activate
    set bounds of front window to {2460, 256, 3299, 736}
    present front document
    play front document
end tell

Now from iTunes I can select the movie I want, run the script, and QuickTime will open it up in full screen on the second monitor and start playing it. Still more hacked together than I would like, but will do for now I suppose.

Solution 2:

http://forums.macosxhints.com/showthread.php?t=59812 contains code to send all an application's windows to a second monitor. You could either run the code on Quicktime Player, or possibly extract the relevant second-monitor-location logic and run it on a single window..

Mirrored code here, for posterity:

tell application "System Events"
    --  set visible of process "Untitled" to false -- don't use name extension
    --  delay 1
    set Name_App to item 1 of (get name of processes whose frontmost is true)
end tell

-- broken
--tell (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Width") to set {monitor1_width, monitor2_width} to {word 3 as number, word 6 as number}
-- fixed by:
set {monitor1_width, monitor2_width} to {1280, 1024}

--tell (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Height") to set {monitor1_height, monitor2_height} to {word 3 as number, word 6 as number}


tell application Name_App
    try
        set {x, y, xx, yy} to bounds of front window
        set The_Scriptable to true
    on error
        set The_result to my get_position(Name_App)
        if The_result is {} then return
        set {x, y} to The_result
        set The_Scriptable to false
    end try
    if The_Scriptable then
        if x <= monitor1_width and xx >= monitor1_width then -- the window is in the first monitor
            if xx > monitor2_width then set xx to monitor2_width
            set New_bounds to {monitor1_width + x, y, monitor1_width + xx, yy}
        else if x >= monitor1_width then -- the window is in the second monitor
            if xx - x > monitor1_width then
                set xx to monitor1_width
            else
                set xx to xx - x
            end if
            set New_bounds to {x - monitor1_width, y, xx, yy}
        else
            --the window is between the monitors
        end if
        set bounds of front window to New_bounds
    else
        if x <= monitor1_width then -- the window is in the first monitor
            set new_Position to {monitor1_width + x, y}

        else -- the window is in the second monitor
            set new_Position to {x - monitor1_width, y}
        end if
        tell application "System Events" to tell process Name_App to set position of front window to new_Position
    end if
    tell front window to "Zoom"

end tell

on get_position(This_App)
    try
        tell application "System Events" to tell process This_App
            return position of front window
        end tell
    on error
        return {}
    end try
end get_position