Greetings,
One of the more annoying things about QuickTime Player is that it doesn't reliably open multiple items in a proper sort order.
This script works just fine, except it won't actually make window 1 active - nor will the sort order stick unless you manually click on the front window.
It seems bizarre to me that Cocoa applications won't properly respect the index property. Is there a work-around other than UI-Scripting?
Thanks.
tell application "Finder"
set db to bounds of window of desktop
set deskX to (item 3 of db) / 2
set deskY to (item 4 of db) / 2
end tell
tell application "QuickTime Player"
try
set winBounds to bounds of front window
set winWidth to (item 3 of winBounds) - (item 1 of winBounds)
set winHeight to (item 4 of winBounds) - (item 2 of winBounds)
set newX1 to (deskX - (winWidth / 2)) as integer
set newY1 to (deskY - (winHeight / 2)) as integer
set newX2 to (newX1 + winWidth) as integer
set newY2 to (newY1 + winHeight) as integer
set newBounds to {newX1, newY1, newX2, newY2}
set winBounds to bounds of front window
set winNames to name of windows
set winNames to sortlist winNames
set winNames to reverse of winNames
repeat with i from 1 to (length of winNames)
set index of window (item i of winNames) to 1
set bounds of front window to newBounds
end repeat
on error errMsg number errNum
beep
display dialog errMsg & return & return & "Error Number: " & errNum
end try
end tell