KM equivalent of Shortcut's "split by line" and then "for each do..."

Hey,

what is the best approach to achieve the equivalent of the Shortcut actions to split text by linebreaks into basically an array of strings and then cycling of each of them with the for each do something?

I fail to see any Keyboard Maestro action to do this. :thinking:

Regexing the clipboard is possible, but how do I do this with a variable number of lines that would have to be stored in variable temporarily?

Thanks a lot in advance

I think the easiest way is to set the for each block’s collection to lines in collection. This screenshot shows a variable called entry being set for a set of static text, but you have several options for text sources, and then putting up an alert containing the content of the line.

Note the option to include/exclude blank lines too.

Hope that helps.

2 Likes

Wow! That is amazing :ok_hand:
I guess I’m thinking too much in the Shortcut “syntax”. KM is still new to me.

Thanks a lot :pray: