Brand new to Keyboard Maestro so I'm hoping this will be an easy one for someone.
My goal is to Paste a series of lines one at a time from the Clipboard (copied from excel as rows) into a web form and submit, once the web form has reloaded paste the next line...etc.
I've searched around and am pretty confident I have the web form actions captured.
I have set the Clipboard contents to a Variable (I'm assuming that this action creates a plain text 'line' for each excel row is this correct?).
I use this Variable in a For Each Item action, but I'm struggling with having the macro paste the lines one at a time. The current format pastes the entire contents of the Variable instead of iterating line by line.
Any education would be sincerely appreciated!
KM first attempt:
Simplified excel data example:
KM result (incorrect). All data vs. single line pasted:
I'm using the current versions of KM and Chrome.
Just to eliminate confusion, in the For each … action,
use For each ExcelLine in these collections…
and then in the Insert Text Action,
Insert text by pasting %Variable%ExcelLine%
You are currently telling it to past the whole “ToChrome” variable for each line in that variable.
At a glance, all you need to do to make this work as intended is change the "Insert text by pasting" action to paste
%Variable%Variable% instead of
%Variable%ToChrome%. You can of course change the variable's name to anything you want, but the key thing to remember is that the variable named at the top of the For Each action is what is used to store each item in the collection that you're working with, so you need to make sure you use that same variable in the appropriate location. Here's an example that adopts @rolian's suggestion, and eliminates the "ToChrome" variable step by reading directly from the clipboard for a bit more efficiency:
For Each.kmactions (2.0 KB)
Ah ok, now I understand the function. Excellent. Thank you both for the speedy responses.