Separate each Line on System Clipboard onto it's own Clipboard

@Zabobon @Nige_S

fixed the issue, it was with Velja, the option to remove tracking params when copying links was selected and it caused the issue.

I actually have a question about the macro and an issue I've been fighting which slows down my workflow.

Whenever I paste multiple items, if perhaps I click too fast the macro bugs out and it skips that paste, or appends all the buffering remaining pastes instead, or just duplicates the paste.

My workflow for example is to grab hundred of links and paste them into my bookmark manager, since my bookmark manager (Anybox) doesn't support pasting multiple items all at once this is hacky way I go around that.

However if I do it too quickly there it can cause the issues that I've listed above.

I actually tried to fully automate the process, have this macro plus another that will just re-trigger this macro until completion instead of manually doing it myself, but since it usually bugs out if it's pasted too fast in between pastes, or sometimes it just happens even if there is a 2 sec wait for some reason, so I can't get it to work quickly enough in some programs without bugging out, thus I can't fully automate this sequential pasting while AFK

*Please just check the sequential paste repeat, not the issue I was having (that's resolved).

The original Macro was designed to paste lines from a multi-line clipboard one line at a time, when pressing the same hotkey. Each time you pressed the hot key and the Macro ran, it pasted the top line of the current clipboard and then resaved the clipboard with that line removed. So, the next time you pressed the hot key it would paste the next line in your list and so on.

But if you want to paste each line of the clipboard, one line at a time, as part of some automated task you could do that in a simpler Macro.

One thing to bear in mind is that each time the Mac Clipboard is used to either copy or paste, the current clipboard changes. So, before doing any pasting we need to convert the contents of the clipboard into a Variable (which will not change as the Macro runs).

  1. Take the contents of the multi-line text that is copied to the Clipboard and make that contents a Variable.
  2. Use a For Each Action to move through the lines one at a time doing whatever task you want to do each time.

To test this out with the example Macro below, copy some multi-line text to the Clipboard, such as

one
two
three
four
five

Then go to some text Application and run the Macro. Replace the green Placeholder Actions with whatever it is you need to acually do. If it trips up, you might need to add some pauses.

EXAMPLE Automated Sequential Paste of Lines in Clipboard Entry v1.00.kmmacros (19.8 KB)

2 Likes

Oh, this makes sense. Thanks.

I only added a pause after the second place holder text as the program tripped up if it didn't have that, now works fine.

Btw, say I copy 200 links into the application like, sometimes I might want to pre-emptively stop, what's the best way to stop this macro, should I add in the loop down below an until action with a keybind trigger?

There are many ways to stop macros.

Perhaps the simplest way is to simply click on the KM Engine icon in the system tray and select Cancel / Cancel all Macros. That will stop all your current macros. I recommend that everyone's first macros is a hotkey macro that runs the KM action called "Cancel all Macros," and if you did that, this would be a very effective solution.

Or you could add an IF statement inside your loop to cancel if it detects the user's desire to stop. Maybe something like this: (it will stop the loop if the user is holding down CTRL and OPT, but keep in mind that the test takes only a split second, and so the user may have to hold it down CTRL+OPT until the loop reaches that action. But this could be a safer way to stop, unlike the suggestions in the previous paragraph.)

image

2 Likes