Filter Clipboard to modify with RegEx or actions?

Just discovered the clipboard filter (trigger:Clipboard Filter [Keyboard Maestro Wiki]) and it's been game changing for simple things like lowercasing and the like.

What I can't seam to figure out is how to transform a clipboard item with any further custom actions?

For example, I know how to make a macro to use RegEx to change

1, 
2, 
3

into

1, 2, 3

But in using "Filter Trigger Clipboard" experimenting with these options, none of them seem to give me control over how the clipboard is actually manipulated. Am I missing a step or is this documented anywhere?



image
image

I replied earlier, but missed the trigger portion of your original note. I've never used this before, but after looking at the wiki, I think you can do what you want to do with this construct:

The macro is set to trigger when the clipboard filter menu is selected, so it appears in the clipboard's Gear icon menu. Then the actual action is set to search the Trigger Clipboard, which is the item on the clipboard associated with the particular gear icon you click.

In my testing, it worked to uppercase the word "Worked" on my clipboard item, regardless of where that item was in the stack. (Obviously, I used a brain-dead simple "regex" that wasn't a regex at all, but just demonstrates that it does work. Replace with your own complex regex as required.)

-rob.

2 Likes

What a wonderful mechanic. How could I have missed that all these years? It's almost as good as a "subroutine."

Works perfectly now, thanks for your help!

I'm missing something. How would someone use this?

I copied what they did in this post, and the name of the macro I created ("NewFilter") appears in the menu list. (See screenshot.) When I clicked on the gear icon for a clipboard, that menu with my own macro name appears.

Screenshot 2023-12-11 at 14.18.29

If your user uses the clipboard switcher, they would be able to "call" your macro using this method. For example, if the user selected and copied an email address into the system clipboard, then you could have a macro called "SendConfirmationMessageToAddress" which would send some sort of message to the user.

It's just a surprising new way to get users to call macros.

If I used the Clipboard Filter menu a lot, it could indeed be useful. Or if I was supporting users who used it a lot. For now, it's just a curiosity. Thanks.