Search and Replace the name of the Variables present in the selected Macros (Blind user)

Hello,

I am a blind user of Keyboard Maestro.

Thank you again for this fabulous software which helps me in my daily accessibility.

(Great people on this forum have helped me in the past)

I am a musician and I use a lot of instruments thanks to the MIDI protocol via Keyboard Maestro.

I have to create a lot of macros with their own variables for each of the devices I control, and this is very tedious for me...

(The variables being a form of memory of the values ​​entered on the instrument)

Is it possible, like Search/Replace in software, to search and then replace the name of the variables present in the selected macros?

Maybe create a macro that would do this?

For example change the variable name My MIDI Value to Test CC 32 in the Macro Group attached.

Some examples of text fields using the same variable name:

  • Prompt for User Input: Variables and Default Values: My MIDI Value, Default Value: %Variable%My MIDI Value%
  • If All Conditions Met Execute Actions, The calculation: My MIDI Value > 0, execute the following actions: Set Variable “My MIDI Value” To Calculation “My MIDI Value - 1”
  • Send MIDI channel 3 controller 23 change to My MIDI Value
  • Send MIDI packet C3 %Hex2%My MIDI Value-1%
  • Speak Text “%Variable%My MIDI Value%”

@peternlewis:

If it doesn't exist would it be possible to implement it in a future version of Keyboard Maestro?

Thank you in advance for your help !

Best Regards,
Mat


My MIDI Value.kmmacros (8.6 KB)


There is no Search & Replace functionality in Keyboard Maestro.

Keyboard Maestro relies heavily on text with tokens, so it would be very difficult to replace a variable name and know which pieces of text are the variable names and which aren't. For example, imagine Search and Replace “Variable” with “NewName” in the calculation:

Variable*CALCULATE(%Variable%Variable%)

I'm not sure I could do it correctly.

Then there are all the cases where a variable is used indirectly, via a script for example.

There are a couple of user macros on the forum that do this...

Hi,

Thanks for your quick reply. I don't use scripts with my macros, only insert actions.

Is it possible to view the selected macro in text format and make a search and replace in an external text editor?

Or is it possible to open .kmmacro in a text editor?

Thanks in advance,

Best regards,

Mat'

Take a look at this:

1 Like

Hi,
Thank you for your reply.
Could you give me some links…?

Yes. Try this:

2 Likes