On 5 Aug 2014, at 12:53 am, Guido Tangorra <email@hidden> wrote:
there's a method to get the menu bar's height, dynamically? There is if you're running 10.9. Save the following as an ASObjC-based library:
use framework "AppKit"
on screenCoords() set theVisible to (current application's NSScreen's mainScreen()'s visibleFrame()) as record set theFull to (current application's NSScreen's mainScreen()'s frame()) as record return {theVisible, theFull} end screenCoords
This will return something like:
--> {{origin:{x:0.0, y:51.0}, |size|:{width:2560.0, height:1367.0}}, {origin:{x:0.0, y:0.0}, |size|:{width:2560.0, height:1440.0}}}
So to get the menu height you would use something like:
tell script "<script name>" set {theVisible, theFull} to theLib's screenCoords() end tell set dockHt to y of origin of theVisible set theDiff to (height of |size| of theFull) - (height of |size| of theVisible) set menuHt to theDiff - dockHt
Having said all that, I'm not sure that it's ever anything other than 22.
|