PURPOSE
This submacro, when run asynchronously immediately before the Show Palette of Macros action, will move the mouse to the upper-left corner of the palette, offset by a specified amount. If the Mouse Offset is specified as two numbers ( X,Y ) the offsets are in pixels. If one or both of the numbers is followed by a percent sign, the number is in percentage of palette width or height. For example 50%,10 would move the mouse to the middle of the palette, 10 pixels from the top.
SETTINGS
local_MouseOffset : If the calling macro does not supply the Mouse Offset via the With Parameter, this variable defines the value that will be used. The default is 10,10 which positions the mouse over the X that can be clicked to close the palette.
CREATING A CALLING MACRO
If this submacro is executed from the Keyboard Maestro Editor using the Run button, a dialog will appear that presents an option to create a calling macro. The dialog will prompt for the Mouse Offset.
RELATED MACRO
Macros that call this macro, via the Execute a Macro action, will include a Show Palette of Macros action. Macros can be manually added to the SPoM action, however, the process can be tedious. For an automated method, see a macro shared by @noisneil: Show a Palette of Macros - Auto-Create and Populate. After using that macro, copy the SPoM action that it creates to the macro that calls this macro.
PROTECTING CALLING MACROS
The first Group action in this macro includes a call to a subroutine (s.𝗸𝗺⇾CheckSubUUID) that will help ensure that current calling macros will work with this and future versions of this submacro.
If an upgraded version of this macro is installed before deleting the previous version (or if this submacro is duplicated), the upgraded version (or duplicate) submacro will display a warning and instructions for repair.
If the import-before-deletion (or duplication) was intended, the warning can be stopped two ways:
-
The OriginalUUID within the first group action can be modified to match the UUID of the newly imported (or duplicated) submacro.
-
The first group action can be deleted. If this is done, however, new calling macros will not be protected.
WARNING: If either of these changes is made, old calling macros will no longer refer to this submacro.
For more information (including a download link for s.𝗸𝗺⇾CheckSubUUID), refer to this Keyboard Maestro Forum Tutorial: Avoiding Upgrade Issues with Submacros and Subroutines
UPGRADING THIS MACRO
If upgrading from an earlier version of this submacro, it is imperative to first delete the older version prior to importing this version into Keyboard Maestro. Note that calling macros do not need to be deleted.
TESTED WITH
• Keyboard Maestro 11.0.1
• Sonoma beta 14.2 (23C5030f)/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445
VERSION HISTORY
( expand / collapse )
1.0 initial version
2.0 The Mouse Offset can now be expressed in percentage of palette width or height. For example 50%,10 would move the mouse to the middle of the palette, 10 pixels from the top.
3.0
a) Streamlined the logic in the first Group action. This group includes logic to protect old calling macros by confirming that this macro was properly upgraded.
b) Bug fix: When I created Version 1 of this submacro, I began by downloading and modifying a similar macro by @noisneil. In hindsight, that was a big mistake because Version 1 (and Version 2) of this submacro shared the same UUID as @noisneil's submacro. That causes problems that I won't detail here; but the issue has been resolved with Version 3+. There is one upgrade complication, however (only for Version 3): calling macros to Version 1 or Version 2 will need to be repaired: the Execute a Macro actions will need to be modified to refer to this Version 3. Alternatively, Version 3+ could be run from the Keyboard Maestro Editor to create a new caller and the Execute a Macro action from the new caller could be copied to the old callers.
3.1 No functional change; just minor changes to the dialog messages in the first Group action: To protect old callers, confirm that the macro was properly upgraded.
4.0
a) For the Group action ‘To protect old callers, confirm that the macro was properly upgraded’ moved the logic to a subroutine (s.𝗸𝗺⇾CheckSubUUID).
b) Updated the TECHNICAL NOTE section.
c) Bug fix: If there was an active Keyboard Maestro Search (top-right), the icon intended for the new calling macro was applied to the enclosing macro group.
If upgrading from an earlier version of this submacro, it is imperative to first delete the older version prior to importing this version into Keyboard Maestro. Note that calling macros do not need to be deleted.
Download: sm.𝗽𝗮𝗹𝗲𝘁𝘁𝗲⇾MoveMouseToPalette.kmmacros (138 KB)
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 14.2 (23C5030f) PRE-RELEASE SEED SOFTWARE
- Keyboard Maestro v11.0.1
Note that sm.𝗽𝗮𝗹𝗲𝘁𝘁𝗲⇾MoveMouseToPalette calls a subroutine named s.𝗸𝗺⇾CheckSubUUID. This subroutine is optional, but recommended. If it is download and installed, the feature discussed in the header comment (section PROTECTING CALLING MACROS) of sm.𝗽𝗮𝗹𝗲𝘁𝘁𝗲⇾MoveMouseToPalette will be provided.
For more information (including a download link for s.𝗸𝗺⇾CheckSubUUID), refer to this Keyboard Maestro Forum Tutorial: Avoiding Upgrade Issues with Submacros and Subroutines
If sm.𝗽𝗮𝗹𝗲𝘁𝘁𝗲⇾MoveMouseToPalette is executed from the Keyboard Maestro Editor using the Run button, it can create its own calling macros.
Here's an example...