Move selected macro(s) to user-specified macro group
Select a macro or macros in Keyboard Maestro Editor, launch this macro, choose a macro group from the prompt by searching or selecting with mouse/arrow keys. Confirmation prompt after the move gives the option go to the macro in its new location by pressing G, or go to it and enable it by pressing E (Insert warning message about enabled untrusted macros here).
For example, relocate, enable, and review or edit a disabled macro you just imported by launching this macro, selecting a group to move it to, and pressing E. No mouse needed.
You can also fire it with an Execute Macro action, using the name of a valid macro group as the parameter. (See sample action in purple)
I made this a couple of months ago, but I've fiddled with it here and there. It's pretty snappy and I'm finding it handy, so I thought it might be of use to others
I searched for toLocation in the KM Editor and there's no mention of it in any of my macros, so where could that be coming from?
Aside:
This is no-doubt a woefully inefficient use of separated AS blocks, but I've come up with an adaptation that I find useful whenever I import macros downloaded from the Forum. More often than not, I'll want to move them from the group they arrive in to my own testing group. This macro does that and then deletes the imported group if no macros remain inside it.
Big guess -- is "toLocation" being passed as the %TriggerValue% when you run it from "Trigger Macro by Name"?
Try adding Display "%TriggerValue%" then a Cancel Macro at the top of the macro and see what pops up...
Edit to add:
Yup -- looks like the "Trigger Macro by Name" action passes the string you've typed as the %TriggerValue% to the macro you are calling. @evanfuch's macro treats any received %TriggerValue% as the value for the local__Move variable (the "otherwise" in the first "If..." action), so firing it with "Trigger by Name" and typing in any filter text is likely to give you a non-existent Group later in the macro.
Not easily solved -- if you had groups "Macros for now" and "Macros for later", filtered with "Macros" and then clicked to select one, your %TriggerValue% wouldn't identify an unique Group. But you could do something like "if %TriggerValue% occurs exactly once in local__Groups then use it, otherwise pop a list of Groups".
I haven't delved deeply into the original yet -- it may be the error handling is throwing a bogus report. But a quick test shows that "Trigger Macro By Name" triggers the chosen macro with a%TriggerValue% of the "filter text" in the Spotlight search field:
Run "Run Me!" and use "a", "ab", abc", etc in the Spotlight field and you'll see what I mean -- clear the field and click the "acbde" macro and you'll see %TriggerValue% is empty.
Since the original macro's first "If" condition is "Is %TriggerValue% empty", the macro will attempt to use any value passed in as the destination macro Group, hence the error.