Depending what you want to do with the lines once they are split there are various ways you could go about this. Could you describe what you want to do with each line once they are split out?
Will there always be 4 lines or sometimes more or less than 4?
Okay. This will do that. (The magenta Action at the top would not be needed in real use as you will be copying the lines. And the last green display Action is only there to show the results.)
I added in a Filter Action to reverse the lines so the first line is the latest in the Clipboard History. If you do not want that you can delete the Filter Action.
After running this you will see the lines in the Clipboard History Switcher as separate past Clipboards.
Thank you, that is greatly appreciated. I am confused to find that this macro works exactly as intended, however, the pastebot clipboard does not reflect the changes, but the Keyboard Maestro clipboard does.
I will make a macro that serves the purpose of the sequential paste using Keyboard Maestro. That should be pretty straightforward.
Clipboard utilities don't always play nice with each other...
I would probably rate this as a bug and report it to the Pastebot people, but I would want to run some tests first. (It turns out that they have a demo.)
I have to slow down the copy to clipboard actions by fully 1/2 a second to get them to stick in Pastebot...
The existing macro in this thread is perfect, I just need it to not remove duplicates because I am pasting data into an agenda and many of those fields are the same.
I'm going to paste the lines one by one into fields in WordPress. I have a second macro that pastes the top item in the clipboard and then deletes it.
Hi @stationagent - it’s not the saving macro that is removing the duplicates. That is what Keyboard Maestro’s Clipboard History does. And as you are using a Keyboard Maestro macro to paste past clipboards it will not allow duplicates.
So not perfect, then. Look at doing it something like this, assuming your first line goes into the first field etc. In pseudocode:
go to first field in web form
for each eachLine in variable
set the system clipboard to contents of eachLine
paste from system clipboard into active form field
keystroke Tab
end for each
...mimicking what you'd do manually.
For more precision you could look at using Javascript to set the fields, by name or id, to the values you want.
I had another think about this. Instead of having two macros it would be simpler to just have a Paste Macro that pastes each line of a single multi-line Clipboard entry one line each time. In other words, no need to split the Clipboard entry into multiple past Clipboards or into Variables.
To use the below Macro, copy the multiple-lined selection to the Clipboard as you normally would by selecting all the lines in one go and pressing ⌘C
Then each time the below Macro is run it pastes one line from the copied text, working its way down the lines one each time. The good thing is that it will allow duplicate lines.
(The method to remove the first line of the Clipboard entry each time is by @Tomhere.)
Another thing. If you leave the Keyboard Maestro History Switcher open (and make it as small as you can) the top entry will show what lines remain and you can see what line will be pasted next (a bit like Pastebot).
EDIT: I have updated my Macro in my post above to version 2.00 to clean up the past clipboards and make this display clearer.
As of yesterday, something very interesting happened.
I did not notice anything that I've done that could influence this behavior, but basically if there is an eligible https://. link, the macro does not work anymore, it works as it should with anything else as it always did.
I tried changing the keybinds, re-enabling the macros, re-installing the macro, restarting KM.
If I exclude the https (I've tried everything, it only fails to work with http:// or https://, so ttps:// doesn't work for example, nor attps://. I guess it has something to do with resolving, but how is that even possible?
I think it might have something to do with the hyperlinks being generated as the text is pasted.
The original Macro works by seeing the text as lines separated by line breaks. It seems that when pasting text that can be seen as a hyperlink address the app being pasted into automatically adds hyperlinks which messes with line breaks, tripping the Macro up. I don't really have an idea how you can deal with that (with the current Macro) as the hyperlinks get added by the App you are pasting into and have the effect of altering the clipboard. I will have a think. Maybe others on the Forum can come up with a solution.
...except you aren't pushing back to the clipboard in your macro, yet the just-pasted item is, somehow, being appended to the clipboard rather than being removed! Strange indeed...
@optimizard -- What apps are you copying from and pasting into? Are you running any other utilities (clipboard managers, Better Touch Tool, Text Expander...) that might mess with the System Clipboard? Can you check your KM Engine log file (in the Editor, Help->Open Logs Folder then open Engine.log) to see if any other macro is triggering at the same time?