Anyway to organize clipboards into a table ready to paste into excel/sheets?

In a current process I'll have 20+ different named clipboards and the macro will paste each value cell by cell,

Example actions: Paste from named 1, Tab, Paste from named 2, Tab, Paste from named 3, Tab, Return to start of next row, Paste from named 4, Tab, etc. etc.

I was curious if there was anyway to organize the named clipboards into a table internally so everything could be pasted all at once.

No, not directly. Only idea I have is to name your Clipboards by Row-Col.
May I ask what you are pasting? If it just plain text, then you would be better off using KM variables.
In fact, I would just put my source data into one KM Variable, with each line a row, each value separated by a character you are not going to use, like TAB.

Yes, just pasting plain text. I had read before ( probably from one of your posts ) that KM variables are a better way to go but I hadn't explored that route as named clipboards had been working fine for me
but what you laid out allows me to paste everything at once which definitely makes the time investment of learning this worth it.

I'm really in the dark on how to get started with this, i suppose the first matter is to understand how the copying process works with variables.

For context, how my copying process currently works is: triple click at x,y coordinates (to select text), copy to named clipboard. Repeat that at 5 different coordinates for 5 more respective named clipboards on the same page and then repeat the process on 2-5 more pages.

After triple clicking to highlight each text should I do "Copy -> Set System Clipboard To Variable And then repeat this for each text with 25 different variables or is there a better way to do this?

If you're just working with plain text, and you've verified that the triple clicking process is successfully highlighting all the text you want copied in each location, all you need to do is append the copied text (i.e. the system clipboard) to the same variable:


Just make sure to delete or otherwise clear the contents of the TextToPaste variable after the final paste into Excel or Sheets so that you start with a clean slate the next time you want to do this.

Incidentally, where are you acquiring the text you're copying? A PDF? A website? Something else? Depending on what it is and/or what app you're using to display it, there could be a better way of acquiring the text than triple-clicking and copying.

Ah, so a couple questions about this

  1. I assume that if I repeated this 35 times it would all paste in one row? I'd want to start a new row every 7 items, how would I distinguish that?
  2. What does the %linefeed% do, does that add in the tabs so items are pasted in different cells?
  3. Sometimes an item on the webpage is not there in which case I'll do - If image is found Triple click, copy to named clipboard, If Image is not found: Set named clipboard text to blank. How would I accomplish this with variables?

I am acquiring the text from a website. Javascript for webscraping is definitely on my "to-learn list" but I think that battle is for another day.

IMO, that is the best and most reliable method.
I have developed several macros that use Execute a JavaScript in Browser action to extract the data and then AppleScript to set the cells in Excel, or other app.

The %LineFeed% token adds a line break/new row. Use in this way, it adds each new item copied into a line below the previous item, rather than all in one row. If you want the items separated by tabs instead, there's a similar token called %Tab% which does just that. If you want every 7 items separated by tabs and the next 7 on a new row, you could do something like this:


(You will of course need to create the ItemCount variable separately if you go this route, probably by creating it via the Variables pane in KM's preferences:


If I understand you correctly, and you wouldn't want the macro to copy anything if the image isn't found, I believe this should work:


1 Like

Gglick you're amazing, thanks for laying this all out for me