For quite a while (at least 3-4 years) I have had this issue where the Debugger window (palette, whatever) will not consistently re-open where I put it previously (i.e. upper right corner of second display.) The issue is intermittent with no rhyme or reason as to why it occurs. In fact, sometimes it can go weeks with the problem not happening at all.
Although the problem occurs randomly, it functions cyclically...What I mean is, when the Debugger is activated, by macro or menubar, instead of reappearing at the position where it was last closed (upper right corner of screen,) the Debugger window initially appears somewhere near the upper left corner of the second display when it begins its cycle of roaming. Subsequent to this, every time the Debugger is closed and reopened, the window cascades down ~10-20px from wherever it was positioned previously. This happens until the window reaches the bottom of the screen, then it pops to the top of the screen and starts cascading again.
I hacked an AppleScript fix a while ago that forces the Debugger to the upper right corner whenever it starts, but, when it first appears, it still flashes somewhere on the screen before the script puts baby in the corner.
This issue has persisted despite completely removing reinstalling Keyboard Maestro, KM app updates, system updates, clearing caches, direct modifications to plist files (and probably 12 other things,) but nothing seems to tame this beast!
# Get position of KM debugger window (must be open).
tell application "System Events"
tell application process "Keyboard Maestro Engine"
tell window "Keyboard Maestro Debugger"
get position
end tell
end tell
end tell
Result: {617, 23}
# Set position of KM debugger window (must be open).
tell application "System Events"
tell application process "Keyboard Maestro Engine"
tell window "Keyboard Maestro Debugger"
set position to {617, 23}
end tell
end tell
end tell
I couldn't get Debugger to play along with this -- opening it doesn't seem to create a %LastWindowID%. I also couldn't see a way to get the width/height of an Engine window (although I didn't look very hard!).
Here's a macro that will open Debugger and move it to the top-right corner of the "main" display while maintaining its last-set size:
Should be reliable -- unless, by some amazing coincidence, you've also got a "Custom HTML Prompt" also titled "Keyboard Maestro Debugger" which you manage to open in the extremely brief period between the Debugger launching and the AppleScript executing...
%LastWindowID% doesn't get an ID but the scripts work.
Manipulate Window failed to find engine window with id “” in macro “Trying” (while executing Move and Resize Engine Window with ID %LastWindowID%)
Nige you're blowing my mind with that example but it makes sense. I feel like I missed AppleScript day in school.
The only tricksie bit is that while KM returns a window frame as
left-edge, top-edge, width, height
...AppleScript's bounds are
{left-edge, top-edge, right-edge, bottom-edge}
So that nasty calculation (which would be much clearer if split up) is simply finding the width and height of the Debugger window and using those values to "work back" from the top-right corner coordinates of the "main" screen to set the new window bounds.
Attached is the macro I use to force the Debugger to bend to my will. This has worked flawlessly since I set it up several years ago. (You'll just need to set your desired position value of the variable: 'defaultDebuggerPosition' and chnage hokey, if you like.)
I used to have the macro function more elegantly with an initial check to determine the position of the Debugger after it appears, and then only set the position if it wasn’t already where I wanted it...
This current version, however, doesn’t check , it just brutishly sets the position every time the Debugger appears, making it function almost invisibly.
In addition to ensuring the Debugger appears in the upper right of my second display, the macro is setup as a toggle so the same hotkey (I use ⇧F1) is used to enable and disable it.