Getting size of title bar (for scripting in QuickTime)

Hi,

I’m scripting something precise which requires me to get the exact location (on the screen) of the top left corner of a movie frame in QuickTime. At present I can get the bounds of the window, but that includes the title bar. I could just work out how big the title bar is and subtract that, but I suspect it will vary with different set-ups/resolutions/fonts etc.

Is there a way to get the title bar size? Or work out the window size not including any title bars or borders?

Thanks,

T

I don’t think (without using Cocoa or ASObjC) that info is available to AS. But I don’t think that it will vary from system to system, though it could from OS release to release. Example: Snow Leopard’s Quicktime X windows are very different from previous OS X versions’ Quicktime 7 windows.

OK, thanks Kevin. The chances of any of my code working in Snow Leopard are, to be honest, slim:)

Here’s the code I’ve written for getting the actual frame size, which might be more robust than just adding on 21-ish pixels for the title bar.

tell application "QuickTime Player"

--get rid of the controls, so window is just frame and title bar
set controller type of document 1 to none

--get coordinates of window
set mybounds to bounds of window 1
set windowwidth to (item 3 of mybounds) - (item 1 of mybounds)
set windowheight to (item 4 of mybounds) - (item 2 of mybounds)

--get current dimensions of movie
set moviedims to dimensions of document 1
set moviewidth to item 1 of moviedims
set movieheight to item 2 of moviedims

--work out where the top left of the movie frame is, by removing any borders and title bars
set topleft_x to (item 1 of mybounds) - ((windowwidth - moviewidth)/2) --movie will be centred horizontally
set topleft_y to (item 2 of mybounds) + (windowheight - movieheight) --movie will be below the titlebar

end tell

Looks good to me. I assume it’s working ok? I’d go with that, if it were me.