Insert text by pasting <> replace specific word with every repeat of macro

I'm working on a Keyboard Maestro macro that repeats a set of actions, I want to replace the text "Trackname" with a word copied from Numbers. After the first iteration, I want the replaced word to revert back to "Trackname" before the macro repeats. Here's my approach so far:

1.Action Setup:
*
I've configured the macro to copy a word from Numbers to replace "Trackname" with it.
2. Issue:
However, I'm unsure how to ensure that "Trackname" is replaced with the copied word and then reverts back to "Trackname" for subsequent iterations.
3. Request for Assistance:
Can someone guide me on how to implement this functionality in Keyboard Maestro? Specifically, how do I ensure that "Trackname" gets replaced by the copied word from Numbers, and then reverts back to "Trackname" for the next iteration of the macro?

Any insights or suggestions would be greatly appreciated!

I might be misunderstanding what you are doing but I think what you are saying is that you have some boilerplate text and want to replace the word "Trackname" with some copied text each time the Macro is run?

A simple approach using one Action could be something like this:

Replace in what app?

Assuming the app you're using doesn't offer a magical "revert after nn seconds if unchanged" option :), you're going to have to have KM revert that data. But before we can help figure out the best way to do that, it would be very useful to know what app is involved.

In addition, within that app, where are you doing this replace/revert operation? Is it a big block of text and the word Trackname can occur many times (and you want them all replaced)? Something else?

In short, can you explain your workflow from start to finish, including app names and descriptions of where these text interactions are occurring in the "need to revert" app?

-rob.

I'm considering a workflow where I use a custom default text and insert various track names while contacting musicians. Here's how it would work:

  1. Open Numbers.
  2. Copy a track name from a column.
  3. Switch to Keyboard Maestro.
  4. Paste the track name into a custom default text using the "Insert text by pasting" action, replacing the placeholder "trackname".
  5. Complete the remaining steps of the macro.
  6. Repeat the process for each track, ensuring the default text is restored after each iteration for seamless copying and pasting of new track names.

Does this approach seem feasible and efficient? Any suggestions for improvement?

I guess I'm unclear on what a "custom default text" is. It sounds like you want a snippet of text to insert in an email message that contains a copied track name from Numbers? And that that track name replaces the word "trackname" in some boilerplate text, right?

If that's what I were trying to write, then @Zabobon's method is the same one I would use: Just set a variable to the boilerplate, and anywhere you would have written the word Trackname, write %SystemClipboard% instead.

Once the macro copies the text in Numbers, you can use the variable LOCAL__Text anywhere you need to. I don't believe the value in the variable will change if you change the system clipboard (by using an Insert Text by Pasting action, for instance) after the macro invokes. If it does, though, you could just add a second step that copies the LOCAL__Text variable to another variable—that one definitely wouldn't change when the clipboard changes.

But I'm guessing there must be more to your macro than that, otherwise the one-step action above is all you need?

-rob.

Before going any further -- do what you want to do manually, taking notes as you go. That'll help solidify want you want to do, answer some questions before we ask them (paste into what in step 4?), and may even produce a "workflow" you can translate almost step-for-step into KM actions.

This is the solution! In stead of Set Vaiable I used Insert Text by Pasting action. Thanks!

1 Like