MACRO: Reveal Custom HTML Prompt v1.0

MACRO: Reveal Custom HTML Prompt v1.0

NOTE: This documentation is a work in progress. I'm not sure what I need to document, so I'll rely on your questions to help finish this documentation.

REQUIRES Keyboard Maestro version 10 and above

PURPOSE:

Gives you the ability to be able to Alt+Tab to a Custom HTML Prompt, and provides a Dock icon for when it's running - you can click the Dock icon to bring the Custom HTML Prompt to the front also.

OVERVIEW:

I've included an AppleScript "Stay Open" app to represent the Custom HTML Prompt while the prompt is open. The AppleScript app doesn't do anything - it just sits there idling, showing an icon in the dock. But it's like any other app - you can click on the icon, or Alt-Tab to it.

There's a macro that gets triggered whenever the AppleScript app activates. This is where the real work is done. It tries to find the prompt, and bring it to the front. If it can't find the prompt, then it terminates the AppleScript app.

I've also added a small snippet of JavaScript to the Custom HTML Prompt that fires when the prompt is about to close. It calls a KM Macro that quits the AppleScript app.

Multiple Desktops (Spaces):

This macro set will work with multiple desktops, but with a few restrictions and requirements.

The main thing is that you must define the desktop that the Custom HTML Prompt will be on. More specifically, you have to assign the AppleScript app to a specific desktop.

You need to assign a hotkey to the desktop, and modify one action in the macro to "type" that hotkey so the right desktop is visible when you want to switch to the Custom HTML Prompt.

There may be other ways to support multiple desktops, but you're on your own there.

INSTALLATION:

Reveal Custom HTML Prompt - Launch Prompt.v1.0.zip (1020.0 KB)

  1. If you have an existing version, delete the group "Reveal Custom HTML Prompt".
  2. Unzip the files.
  3. Double-click the .kmmacros file to import them into Keyboard Maestro. They'll go into a group called "Reveal Custom HTML Prompt".
    • Make sure you enable the group and the macros, if necessary.
  4. Place the "My Prompt" app into a folder somewhere.
    • Run it once,
    • then right-click on the Dock icon, and Quit the app.

USAGE:

  1. Run the macro "Reveal Custom HTML Prompt - Launch Prompt".
  2. Hide it behind a window.
  3. Click the "My Prompt" icon in the taskbar - the prompt should come to the front.
  4. Close the prompt and the AppleScript app should quit also.

FURTHER INSTRUCTIONS:

These macros are actually just examples. You'll probably want to have your own versions for each Custom HTML Prompt you want to have this functionality.

There's not much to any of the macros, so just take a look.

The thing you'll need to modify for sure is "Bring Prompt to Front (Sub-Macro)". Just change the Title in the AppleScript Script.

image

Please post questions and comments below, and I'll figure out what else to document.

4 Likes