In addition to which, I might use the same submacro from several different groups. (That complicates packaging if I want to share the group with others, but makes things easier for me. I have started to have a couple of Utility groups that contain just submacros. And I should put the name of the groups that use the submacro in its comment. That would improve things in that there are only a small number of groups where I would find the macro. (This doesn’t work if I use a top-level macro also as a submacro.)
I just an interesting case where two macro groups I have been trying to distribute for a couple of weeks share one submacro. I ended up just doing a copy and paste, and every time I edited the macro I had to repeat the copy and paste. In the end this isn’t going to work for me because I don’t want the submacro appearing in the group’s palette, but sometimes it might be a reasonable way to go.
That's not the point - it's when there's an Execute Macro, it makes it easier to find the referenced macro. That doesn't show at the top, does it?
Of course if they're all in one group, that solves that issue. But even if I were to put all sub-macros in one group, I'd prefix the ones that are app-specific so I could find, say, all Mail-related sub-macros.
Yep, I've been doing that for a while with all of my macros, not just sub-macros.
I use a very brief code, in brackets, like "[OL]" for Outlook focused macros.
That’s what I have been doing, though I think I split it into two groups: UI manipulations and macros that do more programming-like tasks (macros, AppleScripts, soon I hope ASOjbc, etc.). Not a clear distinction, but good enough. Until I have tens of macros in one of the groups, then I’ll split.
I'll get back again as soon as I find out how to put the KM-Action and KM-Macro data-types back on the Clipboard.
-Chris
---------------------------------------------------------------------------------
# Auth: Christopher Stone { Heavy Lifting by Shane Stanley }
# dCre: 2016/06/03 22:05
# dMod: 2016/06/03 22:33
# Appl: Keyboard Maestro
# Task: Extract Keyboard Maestro action or macro plist from the clipboard.
# Aojc: True
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Extract, @Keyboard_Maestro, @Plist
---------------------------------------------------------------------------------
use framework "Foundation"
use scripting additions
---------------------------------------------------------------------------------
set kmPlistStr to missing value
set systemPasteBoard to current application's NSPasteboard's generalPasteboard()
if (systemPasteBoard's canReadItemWithDataConformingToTypes:{"com.stairways.keyboardmaestro.actionarray"}) as boolean then
# Copied Action or Actions
set kmPlistStr to systemPasteBoard's stringForType:"com.stairways.keyboardmaestro.actionarray"
else if (systemPasteBoard's canReadItemWithDataConformingToTypes:{"com.stairways.keyboardmaestro.macrosarray"}) as boolean then
# Copied Macro or Macros
set kmPlistStr to systemPasteBoard's stringForType:"com.stairways.keyboardmaestro.macrosarray"
end if
if kmPlistStr ≠ missing value then
return kmPlistStr as text
else
beep
end if
---------------------------------------------------------------------------------
Hey Chris, maybe I missed something, but I thought the objective was to read the plist/XML to get the sub-macro name, and then open that macro for editing.
Okay, let’s build upon the “Extract Keyboard Maestro action or macro plist from the clipboard” script.
Open a macro that has an Execute a Macro action in it.
Select that action.
Copy it to the Clipboard.
Run the script.
Find yourself editing the macro called by the selected Execute a Macro action.
-Chris
---------------------------------------------------------------------------------
# Auth: Christopher Stone { Heavy Lifting by Shane Stanley }
# dCre: 2016/06/03 22:05
# dMod: 2016/06/04 01:16
# Appl: Keyboard Maestro
# Task: GO-TO macro of selected “Execute a Macro” action in the Keyboard Maestro Editor.
# Aojc: True
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Extract, @Keyboard_Maestro, @Plist
---------------------------------------------------------------------------------
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
---------------------------------------------------------------------------------
set kmPlistStr to missing value
set actionUUID to missing value
set systemPasteBoard to current application's NSPasteboard's generalPasteboard()
if (systemPasteBoard's canReadItemWithDataConformingToTypes:{"com.stairways.keyboardmaestro.actionarray"}) as boolean then
# Copied Action or Actions
set kmPlistStr to systemPasteBoard's stringForType:"com.stairways.keyboardmaestro.actionarray"
end if
if kmPlistStr ≠ missing value then
set kmPlistStr to kmPlistStr as text
tell application "System Events"
set actionPlistRecord to value of (make property list item with properties {text:kmPlistStr})
set actionUUID to MacroUID of item 1 of actionPlistRecord
end tell
if actionUUID ≠ missing value then
tell application "Keyboard Maestro"
editMacro actionUUID
end tell
end if
else
beep
end if
---------------------------------------------------------------------------------
@peternlewis - If we start deciphering KM’s Clipboard format like this, what kind of headache will this cause either you or us in the future? Do you see yourself needing to change the clipboard format itself? I realize the values in the plists will change, but what about the format itself?
I want a palette, or something palette-like, where I can put the names of the macros I’m currently working on, so I click or double-click a macro and jump right to it in the editor.
Pie-in-the-sky, I’d be able to drag-re-order the list, drag macros to it, remove macros from it, etc.
I have to admit that although just about anything is possible, I don’t expect to get this. But “you have not because you ask not”, so, I’m putting this out there.
I make no promises on the internal format of the macro files, not on the format or arrangement of the Keyboard Maestro preferences folder.
Enjoy whatever you like for as long as it lasts, but if it makes sense to change the format at some point in the future, it'll change and any macros or workflows that depend on it will have to be reworked - I can't afford to have progress of Keyboard Maestro limited by this sort of thing. I could just say "its all private, don't touch", but you may as well get as much value out of it as you can in the mean time, and that time might be decades for all I know.