Has anybody ever experienced the prompt for user input action not displaying the window anywhere on the screen?
Just today on at least three different occasions that I've noticed, a macro has run that shows a user prompt...but the window has not been visible anywhere on the screen. This has resulted in the macro getting stuck in limbo since I can't interact with the prompt, and I have to cancel the macro. But when I run the macro manually, or just trigger the actual prompt for user input action, it still does not appear anywhere. The only thing that resolves the issue is quitting and relaunching the KM engine.
It has happened from time to time in the past, but today it's been happening a lot more, so I wanted to see if anybody else has had this issue and if so, what the solution might be. Thanks all!
In the meantime you can use this AppleScript to reposition the prompt, so you can see it.
tell application "System Events"
tell application process "Keyboard Maestro Engine"
tell window 1
set its position to {10, 40}
end tell
end tell
end tell
Yes, I've had this in the past and I've also always been annoyed by the fact that the position that the user prompt dialog appeared was never entirely predictable.
As a consequence of another thread on this forum I now use this approach that prevents these issues. I always execute a sub macro prior to executing the Prompt for User Input action - a bit like this:
The sub macro which I have named [LIB]_Center Keyboard Maestro Prompts and Alerts positions the following Prompt for User Input dialog consistently. It looks like this:
I have a different solution to this problem. If you have an iPad you should be able to attach it to your Mac using Sidecar and then drag the iPad around your Mac's screen using the Display tab in System Preferences and you will be able to locate and drag the window back to your main screen with your mouse.
Sidecar is very useful with Keyboard Maestro. You can put KM on one screen and test your full screen app on another screen at the same time. My iPad rests at the bottom of my large monitor (when I need it for this purpose) and it gives me a cheap dual monitor setup.
@ccstone question for you about the AppleScript you provided yesterday.... I wrote it as a sub-macro that runs asynchronously consists of a 0.5 second pause and then the script to allow time for the prompt to appear...however it seems to be moving some of my palettes around too...anyway to prevent this?
@peternlewis I'm still having this issue today even though I haven't made any changes to my displays. It also has caused some of my open palettes to disappear on me, presumably off screen as well. Any ideas as to what might be causing this?
EDIT: Also, ever since I installed the latest Big Sur update, window management has been VERY glitchy...basically repositioning a window works about 50% of the time, and the other 50% the window moves to random locations...is this perhaps related?
tell application "System Events"
tell application process "Keyboard Maestro Engine"
tell (first window whose subrole is "AXSystemFloatingWindow" and title is "Keyboard Maestro User Input")
set its position to {20, 40}
end tell
end tell
end tell
I’ve been trying to find resources to learn AppleScript but most of the things I find online are quite outdated. Do you know where I can look to in order to improve my essentially non-existent skills?
AppleScript is not like other languages – unfortunately Apple did a lousy job of moving it forward after its initial development, so applications can have wildly different syntactic requirements. That means you have to learn each app separately. There is significant overlap of course, but it's a challenge – especially without owning a copy of Script Debugger
There is now a Lite [free] version of Script Debugger available – the full version demo reverts to Lite mode if not purchased in 30 days or so.
JXA and AppleScriptObjC have hit the scene, so there are many more tools available than there used to be – but that makes for even more studying...
Thanks Peter, due to other (unrelated) issues I resintalled macOS yesterday, but the window management is still unreliable. I'm wondering if it has to do with my other window management software I have installed.
I've been using Magnet for years, even before I discovered Keyboard Maestro I believe. But when windows management started acting up a couple of weeks ago, I downloaded Rectangle, believing it was a problem with Magnet. Rectangle does appear to work reliably, but Keyboard Maestro's window management is still glitchy. Any ideas of what I can look into to try and remedy this? If I need to make a new topic for this, let me know.
One thing I would suggest is using semaphores whenever you can. Here's why. I sometimes have multiple macros that handle hardware or limited resources, such as the mouse or keyboard (or in your case, the screen.) By putting semaphore locks/unlocks before/after accessing these limited resources, you prevent simultaneous accessing to the same limited resource.
Not only does this solve the problem when multiple macros try to access the same device at the same time, but more importantly it solves the problem of the same macro being run multiple times by different triggers. I find it's all too easy in KM to have the same macro running concurrently due to multiple triggers. Peter, maybe there could be a checkbox at the top of any macro to prevent simultaneous triggers, since most KM users won't ever need to run the same macro concurrently.
Hey Chris, just wanted to chime in and say thanks again for your AppleScript tips. This particular script (along with UI Browser app) have helped me to script other things on my computer (like Mic Drop's microphone monitor which is not a window), and has REALLY helped with some of my workflows. Thanks again!