Calling the subroutine
Only the text need to be specified. The rest of the parameters can use the default value as set in the subroutine macro if they are not specified.
I see. I think you're running an older version of MacOS with wkwebview that does not support the recent Javascript standard? If so, it does not recognise the Optional chaining operator:
Chris,
Np.
I have updated the macro to use document.kmvar. One advantage of using document.kmvar in async custom prompt is that I don't have to add a pause action after the prompt action. Without the delay, there is possibility that the macro is completed before the prompt get the chance to read the local variable (happen especially if prompt is the last action of macro). Another possibility is use global variable which I try to avoid if can let do with local variable.
Jim,
you try the 2nd version that I upload. You can press any key (including ESC key) to close the window as long as it is in focus. Once window lost focus, clicking on the window will close it.
@macdevign_mac — Thank you for this macro! You have no idea how happy I am that you created and shared this at this time! Kudos!
I am going to be moving about a dozen macros to use it to display various messages throughout my day.
A couple of desires:
Would it be easy to move all of the settings into the Custom Prompt with HTML part? This would make it easier to integrate into my existing macros.
Since my messages are designed to interrupt me (Stand up for 1 minute!, or Colemak-DHm Typing Practice Time! for example), I may be typing when it appears, and my typing may accidentally dismiss it. It is easy to change the Press any key to close the window to only the Esc key will close the window?
In my own attempts at designing one of these display messages, I have found that a message that blocks the entire screen is very helpful, as it fully catches and focuses my attention (example screenshot below).Can your code display the background over all (or most of) of the screen? My attempts at making your macro full sized have failed this far (second screenshot).
It would be even better if it didn't always display on the main screen. To explain - I have a 2-screen setup and you macro always displays on the main screen. I want it to display on whichever screen contains the frontmost app window when it runs.
Jim,
use this custom version to fill whole screen and close on Escape key. Even though it center the text, you may need to twitch the CSS accordingly. displaywindow.html.zip (3.4 KB)
tiffle,
For this, I have no idea as the front seem to be the correct parameter according to the wiki at https://wiki.keyboardmaestro.com/function/SCREEN
Most likely you need to try rest of the index value for the SCREEN index parameter to figure what's work. Perhaps you can ask Peter on this ?
troy,
the variable "Local_inputJson" is used to specify those values as shown in example. The custom prompt retrieve those values from Local_inputJson variable using KM's GetVariable function..