• 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: Is dock visible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is dock visible


  • Subject: Re: Is dock visible
  • From: Robert Poland <email@hidden>
  • Date: Sun, 11 Dec 2011 07:36:22 -0700


On Dec 11, 2011, at 12:29 AM, Shane Stanley wrote:

On 11/12/2011, at 3:26 PM, Michelle Steiner wrote:

The only way to programmatically determine whether the Dock is hidden is to check to see whether it is hideable, and to check whether the mouse pointer is in the zone.

Like for instance:

script dockIsShowing
set fudge to 10 -- allowance for hidden Dock
set screenWithMenu to current application's NSScreen's screens()'s objectAtIndex_(0)
set {x1, y1} to (screenWithMenu's visibleFrame()'s |size|()) as list
set {x2, y2} to (screenWithMenu's frame()'s |size|()) as list
if (x2 - x1) > fudge or (y2 - y1) > (22 + fudge) then -- 22 is standard menubar height
return true
end if
set {x3, y3} to current application's NSEvent's mouseLocation() as list
if (x3 > x1) or (y3 > y1) then -- mouse is beyond visible frame
return true
end if
return false
end script

tell application "ASObjC Runner" to set theResult to run the script {dockIsShowing} with result returned

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

I tried to explore Shane's example…

Even after I found and installed ASObjC Runner it won't compile. Got errors on "frame()'s" and "returned".


Robert Poland - Fort Collins, CO



 _______________________________________________
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: Is dock visible
      • From: Shane Stanley <email@hidden>
References: 
 >Is dock visable (From: Robert Poland <email@hidden>)
 >Re: Is dock visable (From: Robert Poland <email@hidden>)
 >Re: Is dock visible (From: Michelle Steiner <email@hidden>)
 >Re: Is dock visible (From: Robert Poland <email@hidden>)
 >Re: Is dock visible (From: Michelle Steiner <email@hidden>)
 >Re: Is dock visible (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Is dock visible
  • Next by Date: Re: Closing Safari Tab...
  • Previous by thread: Re: Is dock visible
  • Next by thread: Re: Is dock visible
  • Index(es):
    • Date
    • Thread