Report Properties of the Front Window


image


Hey Folks,

Are you having problems working with a window in an application?

Not all windows are created equal on macOS, and Keyboard Maestro is not able to manipulate every different kind of window – so at some point it may become necessary to find out more about a given window (to keep you from pulling your hair out).

This macro invites the user to pick from a list of window titles and returns that window's various properties.

This window is BBEdit's Character Inspector Palette, and its window type is a system floating window designated in the pick-list by the more arcane accessibility code «AXSystemFloatingWindow» in the dialog.

----------------------------------------------------
Window Name  :  Character Inspector
Application  :  BBEdit
----------------------------------------------------
minimum value              :  missing value
orientation                :  missing value
position                   :  {980, 69}
class                      :  window
accessibility description  :  missing value
role description           :  system floating window
focused                    :  true
custom title               :  Character Inspector
size                       :  {276, 232}
help                       :  missing value
entire contents            :  {}
enabled                    :  missing value
maximum value              :  missing value
role                       :  AXWindow
value                      :  missing value
subrole                    :  AXSystemFloatingWindow
selected                   :  missing value
name                       :  Character Inspector
description                :  system floating window
----------------------------------------------------

Output may be sent to BBEdit, a Keyboard Maestro Display-Text Window, or TextEdit.

The default is BBEdit, but if it is not installed output will automatically shunt to TextEdit.

Adjust to your preference using this setting:

image


Download: Report Window Properties v2.00.kmmacros (27 KB)

Macro Image


I have other window analysis tools on the forum. Here's one, and I'll add more when I have time:

-Chris

6 Likes

Thanks Chris,

Sounds amazing. Indeed I'd wish such a tool would exist for buttons. :wink:

To me it appears way more often that it takes me a lot of time not being "very" productive :roll_eyes: to figure out what behaves as a button and is reachable - and what is not - for KM with the related actions.

Cheers,

HaPe

This isn't exclusively for buttons, but they will be included in the object hierarchy the macro produces.

Front Window Analysis Tool Using AppleScript System Events (List UI Elements)

1 Like

Thanks Chris. I checked it with a pretty simple application but my skills are (again) probably by far not good enough to interpret and work with the result.

It's obviously just me but I would need a tool that avoids the pretty time consuming method using KM with i.e. "If Then Else" -> Button Condition and the referring evaluation to check if KM is able to work with the UI element as a Button or not.

EDIT: Dealing again with this topic inspired me to think about a simple solution that fit my needs. So I created myself a pretty simple macro that I can use to check if KM "sees" a UI element as a button.

Thanks for the inspiration. :grinning:

All the macro is displaying is the outer window shell, and that usually means the content is not built according to normal Apple UI specifications.

I.e. the app cannot be UI-Scripted with System Events.

You can confirm my suspicion by running this in Script Debugger or Apple's anemic Script Editor app.

tell application "System Events"
   tell application process "MONTAGE Connect"
      return entire contents of front window
   end tell
end tell

Make sure you get the name of the process right – you can use this and search the result:

tell application "System Events"
   return name of every process
end tell

You may also want to determine if the window pictured is the only one.

tell application "System Events"
   tell application process "MONTAGE Connect"
      return name of every window
   end tell
end tell
2 Likes

Thanks Chris. I checked it using the Script Editor app. It again gave me just "button 1" as a result. I saved the scripts and will check them with other apps when I have the need.