Replace Part of a File Path in All Macros

I have hundreds of macros that reference a file path and I just created a variable so I can quickly update part of that file path for dropbox. Is there a way to replace the varible in every macro at once

I want to replace

~/Dropbox

With

%DropboxPersonal%

I can filter of course all the macros that have the file path and AppleScripts notes etc to ~/Dropbox

Perhaps a RegEx or something in the search or somewhere in Keyboard Maestro to do this.
\/~/Dropbox

I am going through and doing one by one manually but taking over an hour and this would be a great tool to know if there is a way to do this more efficiently as I try to update things that change in many macros.

The Architect of KM says there is no search and replace within a macro.

There might be people who have accomplished this using XML and uploaded solutions to the Macros page on this website. It's probably not 100% reliable because strings can occur in all kinds of strange places in actions.

You can search for strings in the editor, but there's no replace.

Perhaps the lesson here is never hardcode string constants, at least not repeatedly. Always use variables so you have to change something only once.

2 Likes

Thank you and yes lesson learned that was over two hours to change and update things! Plus I am not sure I did everything just right until I run into error but I hope I did. I am slowly learning that lesson and love that macros can be referenced and call subroutines. Thank you always for your fast replies, you are dedicated on a late Friday night or whatever time it is in the world for you!

2 Likes