Launch (Click) an application from Doc (Mac)?

Hi - I have to click an application from Doc (i.e Mac OS). eg Launch Safari browser.

Here is what I did…

  1. Added an image of the application (eg MyApp)
  2. click (“MyApp”)
  3. This works Ok if the application always stays in that position.

If some other appliation is removed from the doc then MYApp’s relative position changes and eggPlant says “MyApp - image not found”.

It’s not that the app’s position has changed, it’s that the Dock icons are dynamically resized based on the amount of room that is available to them. Add an icon and all the others get smaller, take one away and they all get bigger. The Dock is not considered a reliable way of launching an application with eggPlant and we advise against doing it.

A more reliable way of launching an application is to access the Applications folder, type the applications name, and press command + o to open it. The following code launches FireFox; you could parameterize it to launch any specified application

typeText F11
Click (150,150)
TypeText shiftKey, commandKey, "a"
TypeText "FireFox"
TypeText commandkey, "o"

[quote=“EggplantMatt”]…The Dock is not considered a reliable way of launching an application with eggPlant and we advise against doing it.


One of the usecase is that our application should be added to the doc upon installation and users should be able to click that application from Doc and Launch. I still believe eggplant can do that?

It can be done, but as you’ve already seen, in order for it to work, you need to control the contents of the dock on the test system. If you can make sure that there’s a set number of icons, the size should be consistent. You probably also want to control what is being displayed behind the dock, so make sure there aren’t any application windows behind it and the desktop is a solid color. Better still, capture only within the bounds of the icon, and don’t include any of the background.

The dock will start resizing when it’s reached the limit, of the screen. As long as all the icons “fit” within the width of the screen adding and removing a single application won’t change their sizes.

A great way to set the dock size to something predictable is to hold down the Option key and drag down (or up) on the Dock’s divider line (to the left of the trash can). This will have the dock set itself to some standard sizes (I think 16x16, 24x24, 32x32) up until they no longer fit (as described above).

Of course the BEST way to ensure you don’t have too many icons is to make the dock as small as possible. (This is the same as setting the dock size to minimum in the preferences). In situations where it’s required that the dock is a fixed size I recommend a script to launch System Preferences and set that minimum dock size.

You could also look for a specific color in the icon if no other icons use it and then click that color or you could click a coordinate if it will be in the same place all the time.

To open from the dock, you could also do Control-F3 then arrow key to get to it, and TypeText return to launch.

For example, with Finder active:

TypeText CommandKey, ShiftKey, “A”
TypeText “foo” # to get to, replace with your app name
TypeCommand “o” # open it. is not on dock, so it’ll be the first one to the left of the divider that Jonathan mentioned (Trash Can is one leftArrow).

TypeText ControlKey, F3
TypeText “foo” # selects foo on Dock
TypeText downArrow,downArrow, return # select “Keep in Dock”