How to position the KM's “Icon Chooser: Character” floating window

Hey Larry,

If you're trying to get properties of a floating window from the Script Editor.app or Script Debugger, you need to take into account that these often disappear when their application is in the background.

The easiest way to deal with that is to use set frontmost to true like so:

tell application "System Events"
   tell application process "Keyboard Maestro"
      set frontmost to true
      properties of windows
   end tell
end tell

Then return to your Applescript Editor and examine the result:

tell application "System Events"
   tell application process "Keyboard Maestro"
      tell (first window whose name is "Icon Chooser: Internal")
         set position to {1540, 23}
      end tell
   end tell
end tell

On the other hand the technique I use is to run a script in Script Debugger from another script.

So – I'd take the first script and remove the set frontmost to true line.

Then I'd use another script with a global keyboard shortcut to run it.

tell application "Script Debugger"
   tell document 1
      execute
   end tell
end tell

This lets me run complicated scripts that need an app to be frontmost and have results returned in the editor (without having to switch between Script Debugger and the app).

-Chris

2 Likes