Select subroutines by name and group

KM Subroutines have qualitatively changed how I use the app. I now approach it much as I approach other programming tasks, taking most of the actual work and putting it into subroutines that can then be tested, debugged in isolation, and reused.

Unfortunately as my collection of subroutines grows (I have a hundred or so at this point), so does the time that it takes to find them through the Execute Subroutine action.

It would be extremely useful to have the same excellent search interface for Execute Subroutine that is available for Execute Macro.

1 Like

Do you mean the Select Macro by Name… option in the Execute a Macro action?

The Execute Subroutine doesn't have that because it lists only Subroutine macros, but I will note the request down.

2 Likes

Perhaps a quick fix is possible? (Knowing full well that's a lot easier for me to say than for you to do!)

"Execute a Macro"s popup is targetable by drag'n'drop -- using two Editor windows, window 1 showing macros and window 2 editing the current macro's "Execute" action, you can Search in window 1and simply drag the required macro onto the action in window 2.

Make "Execute a subroutine"s popup targetable and you could do the same, using something like t:sub n:"Macro I want" in window 1's Search field.

2 Likes

I second this method. I never add the action for a sub any more.

2 Likes

Wow!

I meant "drag it onto the popup menu to select it" -- I didn't realise you could just drag a subroutine into a macro and KM would add an "Execute Subroutine" action already set to use that sub.

Love this Forum...

4 Likes

Note that you can also make a Smart Group of all your subroutines with the t:subroutine search.

4 Likes

I didn't know about drag and drop for subroutines either. That makes my life much easier! Adding a Smart Group helps even more.

I'll second Nige's comment. Great forum!

@peternlewis What I was suggesting was both the "Add by name" and "Search Group" features. I have a group for general purpose subroutines, but most of my subroutines live in the groups to which they are most relevant. Opening a second window and doing a drag and drop works really well, but there are still times when the easiest thing to do would be to search for a macro either by name or by group.

I thought you meant this search would find Subroutines. This search only gives me macros that call a subroutine.

Running KM 11.0.3, Sequoia 15.2.

Can I do a search that just gives Subroutines?

For me, it comes up empty, whether in the top search box or a smart folder's search box:

I have probably 50 subroutines called from over 100 macros.

Weird.

-rob.

Try a space after the colon.

1 Like

Oh, that's hilarious, as when I tried it, I copied and pasted Peter's text, just to make sure I didn't make a typo ... no space in his version. :slight_smile:

Hey @peternlewis—should t:subroutine work to make a smart group of all subroutines? Because it seems to come up blank. If you use t: subroutine, then you get a list of all macros that call subroutines, but not the actual subroutines themselves.

-rob.

2 Likes

It should be t:subroutine but there was an issue with that not matching correctly (which is already fixed for the next version, which I really should get around to releasing).

3 Likes

A slightly delayed Christmas present for all! :slight_smile:

-rob.

1 Like