Move/click mouse from top left of SPECIFIC window?

Is it possible to use the action for Move and Click Mouse from the Top Left Corner of a SPECIFIC window?

I see we can use this relative to the main window, or the full screen, or a found image, but not relative to a specific window.

The reason I'm asking is that I'm trying to use this in an app that has a ton of floating windows with specific names, so the concept of "Main Window" isn't helpful -- the command I'm trying to target is in a non-main window but I can't bring it to the front because it's floating.

Hey David,

Keyboard Maestro doesn't see floating windows.

You can try out the tools posted in this thread: Window Information Tools

With them you should (hopefully) be able to glean the information you need to calculate your click.

Note that it's also possible that you might be able to use UI-Scripting instead of trying to click based on window position.

-Chris

Hmmm. In this particular app (Pixelmator) I think it does see the floating window. I wrote an action that said: click on a found image in this window (and I named the name of the floating window) and it works.

However, Pixelmator has several floating windows and none of them have the ability to become frontmost, so I can't use "main window" as a target.

I'm short on time but will check out your tip on Window Information Tools later today. Where do I find info on UI-Scripting? (I'm not familiar with it.)

Hey David,

I have Pixelmator 3.8.1, so I can test if you'll post an image of what you're working with.

Google: os x gui scripting

It's a complex topic.

There's quite a lot of information available on the Keyboard Maestro forum.

Other sources are:

Script Debugger Forum

The Applescript Users List and (archive)

The UI Browser List

Apple doesn't have much formal documentation on it unfortunately.

-Chris

Hey David,

Taking a quick look at Pixelmator on my system.

Visible Windows:

window "Image Ferrari Enzo ⇢ The open image file.
window "Tools
window "Layers
window "Effects Browser

Invisible Windows:

window 2
window 3
window 5
window 7
window 8

If you can find your window by name you can get it's position, height, and width.

If Keyboard Maestro can see it then you can do this with Keyboard Maestro.

If System Events can see it you can do it with AppleScript.

Named palette windows can be brought to the front by clicking them, but Keyboard Maestro doesn't seem to be able to change the window index.

Here's an example AppleScript you can run from the Applescript Editor:

tell application "System Events"
   tell application process "Pixelmator"
      set frontmost to true
      delay 0.1
      tell window "Tools"
         return {position, size}
      end tell
   end tell
end tell

This works to bring the Tools palette to the front:

tell application "System Events"
   tell application process "Pixelmator"
      set frontmost to true
      delay 0.1
      tell window "Tools"
         perform action "AXRaise"
      end tell
   end tell
end tell

The Tools palette does NOT contain UI elements that System Events can see, but the Layers and Effects Browser palettes DO contain accessible UI elements.

You also may be able to use the Found Image condition to click where you need if you have a unique image.

The upshot is that many things are possible here.

-Chris