当我在 QuickTime 中启动电影时,我希望它始终在我的第二个显示器(而不是默认的主显示器)上打开。我实际上是通过 iTunes 中的 AppleScript 打开电影,因此 AppleScript 解决方案是可以的。
Quicktime 中曾经有一个首选项设置,可以让您将其默认为特定显示,但是该功能似乎在 QuickTime X 中已经丢失了。
答案1
好的,所以我继续捕获位于第二个屏幕中间的窗口的边界,并在 AppleScript 中添加一行以便每次都将新窗口推送到那里。
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
现在我可以从 iTunes 中选择我想要的电影,运行脚本,然后 QuickTime 会在第二个显示器上全屏打开并开始播放。虽然还不是我想要的那么复杂,但我想现在就够了。
答案2
http://forums.macosxhints.com/showthread.php?t=59812包含将应用程序的所有窗口发送到第二台显示器的代码。您可以在 Quicktime Player 上运行该代码,也可以提取相关的第二台显示器位置逻辑并在单个窗口上运行它。
此处镜像代码,以供后人参考:
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
答案3
我知道当我运行双显示器设置时,它会记住我在第二台显示器上的内容,即使我没有连接它。如果你将窗口拖到该显示器上,你也许可以训练它记住把它放在那里。
答案4
显然,10.6 版附带的 QT X 并不完整。应该有一个可选安装,可以从 SL 安装光盘重新安装旧版本的 QT。QT X 似乎不允许您设置默认全屏显示器。