Real Software Forums
http://forums.realsoftware.com/

Detect where my App is in DOCK
http://forums.realsoftware.com/viewtopic.php?f=7&t=45988
Page 1 of 2

Author:  DaveS [ Mon Nov 19, 2012 7:31 pm ]
Post subject:  Detect where my App is in DOCK

Is there a way for an app to locate the exact screen position of its own icon in the OSX dock?

I want to be able to open a window directly above the icon (or the left/right/bottom if the user moved the dock around)

basically the same X/Y position as the right click OSX menu appears..

Author:  MadDoc [ Tue Nov 20, 2012 6:19 am ]
Post subject:  Re: Detect where my App is in DOCK

That doesn't seem standard behaviour. What are you trying to achieve?

Author:  DaveS [ Tue Nov 20, 2012 8:24 am ]
Post subject:  Re: Detect where my App is in DOCK

What I am trying to achieve or the fact that is or is not "standard behaviour" wasn't the question.

The question was how to detect the location of the program icon in the dock. Possible yes or no.

Author:  devulder [ Tue Nov 20, 2012 8:47 am ]
Post subject:  Re: Detect where my App is in DOCK

DaveS wrote:
What I am trying to achieve or the fact that is or is not "standard behaviour" wasn't the question.

The question was how to detect the location of the program icon in the dock. Possible yes or no.


Look here

http://decio.eu/2012/03/27/dockutil-le- ... -dock-osx/

Author:  DaveS [ Tue Nov 20, 2012 8:57 am ]
Post subject:  Re: Detect where my App is in DOCK

Thanks.... should have qualified... "without using 3rd party utilities".

Author:  pony [ Tue Nov 20, 2012 2:31 pm ]
Post subject:  Re: Detect where my App is in DOCK

You could look at defaults read com.apple.dock

Find the dock orientation (left, right, bottom). Find the tile size. Find the center point of the display. Count where your icon sits in relation to other icons. Do the math.

Author:  jranieri [ Tue Nov 20, 2012 3:22 pm ]
Post subject:  Re: Detect where my App is in DOCK

pony wrote:
You could look at defaults read com.apple.dock

Find the dock orientation (left, right, bottom). Find the tile size. Find the center point of the display. Count where your icon sits in relation to other icons. Do the math.


Please don't do this, the Dock user defaults are not a public API and could change at any point. You might try using OS X's accessibility APIs to accomplish this, but I can't think of any other application that uses such a user interface (which is typically a good indicator that it has flaws).

Author:  DaveS [ Tue Nov 20, 2012 3:29 pm ]
Post subject:  Re: Detect where my App is in DOCK

Quote:
but I can't think of any other application that uses such a user interface (which is typically a good indicator that it has flaws).


Uh..... FINDER?????
the only difference is I want to "click".... since Finder already intercepts "right click"

AppleEvents notifiies of when the click occurs.

Author:  Thom McGrath [ Tue Nov 20, 2012 4:31 pm ]
Post subject:  Re: Detect where my App is in DOCK

Pretty confident you're not going to find a way to do this.

Author:  DaveS [ Tue Nov 20, 2012 4:37 pm ]
Post subject:  Re: Detect where my App is in DOCK

LOL
a challenge?
You're on.

Author:  Thom McGrath [ Tue Nov 20, 2012 4:43 pm ]
Post subject:  Re: Detect where my App is in DOCK

You'll probably have more luck taking a screenshot and literally searching for your icon. Needless to say, performance will suck, and you'll have trouble even taking the screenshot without relying on something outside of the product.

Author:  ktekinay [ Tue Nov 20, 2012 6:08 pm ]
Post subject:  Re: Detect where my App is in DOCK

Dave, take a look at the app DockView. It displays thumbnails of open windows when you point at an app's Dock icon. Is this along the lines of what you're trying to achieve?

Author:  DaveS [ Tue Nov 20, 2012 6:35 pm ]
Post subject:  Re: Detect where my App is in DOCK

ktekinay wrote:
Dave, take a look at the app DockView. It displays thumbnails of open windows when you point at an app's Dock icon. Is this along the lines of what you're trying to achieve?


Not "exactly"... but the X/Y pos where the thumbnails in DockView are shown is the information I am trying to get.

Author:  ktekinay [ Tue Nov 20, 2012 6:54 pm ]
Post subject:  Re: Detect where my App is in DOCK

Right, as I thought. Unfortunately, I have no idea how he does it, but perhaps the author will be willing to share.

Author:  jranieri [ Tue Nov 20, 2012 6:58 pm ]
Post subject:  Re: Detect where my App is in DOCK

It uses the accessibility APIs that I mentioned.

Page 1 of 2 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/