• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Applescript AeroSnap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript AeroSnap


  • Subject: Re: Applescript AeroSnap
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 05 Aug 2014 09:57:41 +1000

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.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Applescript AeroSnap
      • From: Guido Tangorra <email@hidden>
    • Re: Applescript AeroSnap
      • From: Paul Berkowitz <email@hidden>
References: 
 >Applescript AeroSnap (From: Guido Tangorra <email@hidden>)

  • Prev by Date: Re: find problem
  • Next by Date: Send Mail Headers and Contents to BBEdit
  • Previous by thread: Re: Applescript AeroSnap
  • Next by thread: Re: Applescript AeroSnap
  • Index(es):
    • Date
    • Thread