Rename Selected Macros with (or without) Regex
Version 1.0
Purpose
This macro allows you rename selected macros using Search/Replace, optionally using Regular Expressions.
Includes the option to do a "Trial Run" so you can see what would be changed, before actually changing anything.
Note: I know there are other macros on the forum that do something similar, but I believe this macro offers features the others don't.
The Prompt
Documentation:
Click to expand
Search String:
Required. The string to search for in the macro names. It can include Regular Expression syntax depending on the Search Type.
Replace String:
Optional. Replaces (or deletes if left blank) what was matched by Search String.
Search Type:
- Case Sensitive: Does a "Replace All" in each macro name, and as the name indicates, upper- and lower-case letters must match exactly.
- Ignore Case: Does a "Replace All" in each macro name, and ignores character case when matching Search String.
- Regular Expression: Allows you to use Regular Expressions in Search String.
Regular Expression Flags:
Ignored if Search String is not Regular Expression. Otherwise, you can include Regular Expression Flags here.
Some common flags:
- g : If you include "g" here, it will do a "replace all" in each macro name, otherwise it will replace the first match only in each macro name.
- i : Ignore Case.
Show Log:
If checked, a log will be displayed showing what was changed.
NOTE: When doing a Trial Run, this setting is ignored, because trial runs always show the log.
Save Variables:
If checked, the values you enter in this prompt are saved to the global variable "RSN_variables", and reused the next time you run the prompt.
If unchecked, the values are not saved, and "RSN_variables" is cleared.
Trial Run:
If you click this button, it will perform a "trial run", which means a log will be shown showing what would have been changed.
Rename:
Runs the search/replace and updates the macro names.
A Note About Undo:
You can always undo the changes to your macro names using the standard "Undo" methods, like ⌘z or Edit-->Undo.
VERSION HISTORY
1.0 - Initial Release
INSTALLATION
Rename Selected Macros with (or without) Regex.v1.0.kmmacros.zip (14.6 KB)
Download the macro, unzip it, and double-click the .kmmacros file.