Paste In Order Copied

Use Case

  • Sometimes you need to copy things (text & graphics) in the same order as you want to paste them.
  • It is a big hassle to copy one item, switch to the target destination, paste, then switch back, ad infinitum. :frowning_face:
  • So this pair of macros lets you copy everything at once.
  • Then, when done, switch to the destination, and paste in order, all at once, or one at a time.
  • And, you can select from one a several common separators, or roll-your-own.
  • Check out the video demos below.

==UPDATED==: 2020-04-19 17:32 GMT-5

  • ADD Option to Paste as Plain Text

How To Use These Pair of Macros

  1. Select text and/or graphics from any source in the order you want to paste
  2. Select the first block to copy
  3. Trigger the Copy and Prepare for Paste Macro (⌃C)
  4. Continue Selecting/Copying (from same source or other) until you have everything you want.
    .
  5. Trigger the Paste In Order Copied Macro (⌃V)
    • It knows the number of Clipboards to Paste from the Copy Macro.
      • OR, you can override with the last N Clipboards to paste.
    • Choose the Delimiter (Separator) to Use between pastes
      • Choose from predefined, nothing, or custom
      • If custom, enter the custom delimiter
    • Choose Whether to Paste or Type the Delimiter
      • For most text documents, Paste will work fine, and is fastest
      • For apps like Excel, or Web apps with fields, choose TAB as delimited, and TYPE to insert the Delimiter.
    • Press Return or Click OK when ready to proceed.

MACRO:   Paste In Order Copied

-~~~ VER: 2.1    2020-04-19 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Paste In Order Copied.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.

NOTE: both of these macros were uploaded with a hot key trigger
because they both make use of a "Long Press Key" trigger option, which has to be the same as the normal trigger. You can change both, if you'd like.


As always, please feel free to post below any questions, issues, or suggestions you may have about these macros.


Example Output


Demos

1. Paste Images into Text Edit

2.Paste Text into Excel Cells



ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Paste Clipboards In Order They Were Copied
    • Using your Clipboard History, starts with the oldest Clipboard, and Pastes each one until the most recent Clipboard (prior to this macro) has been Pasted.
    • Works with Plain Text, Styled Text, and Images.
    • Optionally, you may choose to Paste as PLAIN Text.
    • An Optional Dellimiter May be Pasted or Typed between each Clipboard.
      • For example, you can use a TAB that is TYPED to Paste Clipboards into Excel, each Clipboard in a separate cell.
    • Optionally, you can delete all Clipboards in the set when done.
    • You may Paste All-at-once, or One Clipboard per trigger of the macro.
    • May be used Stand-alone, or With a Companion Macro Which Does the Coping and Keeps Count of Clipboards.

Companion Macro: Copy & Prepare for Paste In Order

REQUIRES:

  1. KM 8.0.2+
  • But it can be written in KM 7.3.1+
  • It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
    .
  1. macOS 10.11.6 (El Capitan)
  • KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:

NOTICE: This macro has had limited testing.

  • It has had very limited testing, but works to the best of my knowledge.
  • You need to test further before using in a production environment.
  • It does not have extensive error checking/handling.
  • It can result in the permanent loss of some clipboards in your history, IF you choose that option. Otherwise, it is non-destructive by design.

How To Use

  1. It is best to trigger the Copy Macro first, for each object you want to paste.
  2. Trigger this macro.
    • Use a NORMAL Keypress of ⌃V to Paste All-At-Once and Configure the Paste Options.
    • Use a LONG PRESS Key of ⌃V to Paste just ONE Clipboard.
    • In both cases, it will automatically cycle to the next clipboard.
    • If you are Pasting into a Rich Text App (like TextEdit), you can choose to Paste OR Type a Delimiter to be Inserted After the Clipboard Paste.
    • If you are pasting into an app like Excel, or any app or web page that has fields, then you need to TYPE the Delimiter to move to the next field. Usually this is the TAB character.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
  1. Assign a Trigger to this maro..
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • Generally you will not need to make any changes, except for:
      • Set Variable CustomDelimiter
      • The Macro provides for these Delimiters, which you can choose from the Prompt: Return|Tab|Space|LIneFeed|HorizontalLine|Nothing
      • If you need a different Delimiter, you can set the CustomDelimter

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.


Companion Macro

MACRO:   Copy & Prepare for Paste in Order

-~~~ VER: 2.0    2018-07-20 ~~~

DOWNLOAD:

Copy & Prepare for Paste in Order.kmmacros (18 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Copy and Retain Count of Clipboards
    • This Macro, used with its Companion Macro enables you to easily copy objects in the order you want to have them appear when you paste them.
    • As you Copy each object, it keeps count and notifies you.
    • This macro is NOT required -- it just make keeping count easier.

Companion Macro: Paste In Order Copied

REQUIRES:

  1. KM 8.0.2+
  • But it can be written in KM 7.3.1+
  • It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
    .
  1. macOS 10.11.6 (El Capitan)
  • KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:

NOTICE: This macro has had limited testing.

  • It has had very limited testing, but works to the best of my knowledge.
  • You need to test further before using in a production environment.
  • It does not have extensive error checking/handling.

How To Use

  1. Select the object (text, images, or both) on any source (app or web page).
  2. Trigger this macro.
    • Use a NORMAL Keypress of ⌃C to Copy and Increment the Count
    • Use a LONG PRESS Key of ⌃C to Copy and Reset the Count to 1.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
  1. Confirm/Change the Trigger assigned to this maro..
  2. Move this macro to a global Macro Group
  3. ENABLE this Macro.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • Generally you will not need to make any changes, except for:
      • Set Variable CustomDelimiter
      • The Macro provides for these Delimiters, which you can choose from the Prompt: Return|Tab|Space|LIneFeed|HorizontalLine|Nothing
      • If you need a different Delimiter, you can set the CustomDelimter

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

image

15 Likes

Wow, the Paste part is magic. Thank you very much.

Can't the Copy part be automated as well?

Ask the user to insert the separators and number of copies to be taken; then, the macro will use separators and make as many copies as given by the user.

For texts separated by return, for example, I have been using a very trivial macro to automate the copying process.

__CopyEachLine.kmmacros (5.1 KB)

it is a very trivial macro; but much better than manually copying each line.

With your skill, you can create a complete magic that could fully automate the copying as well.

Would it be possible to have the 'Paste In Order Copied' macro wait for a mouse click before pasting the next item?

I'm not sure what you mean by this. How would the macro know what is to be copied?

The Paste macro does offer you exactly that:

image

Yep. Just add this Pause just before the Paste:

image

1 Like

Apologies, if I had taken the time to look at the macro instead of blindly firing off my question, I might have seen that for myself. - the take-away? Take a few minutes to look at a macro and understand it the best you can before shooting off a question!
Thanx as always.

1 Like

Hello, i just downloaded this copy/paste combo script, and it's doesn't seem to work right.
It only copies and pastes last string i chose, just like normal cmd+c cmd+v would.
Any suggestions?
(Yes, i enabled both of them)

And what's that dialogue window you've shown in a video above?
I have nothing like this appearing.

Have you changed the macro in any way?
It is still running fine for me in Keyboard Maestro 8.2.3 on macOS 10.12.6.
I've not had any other reports of problems.

If you are not seeing this dialogue, then something basic is wrong:

In order to copy multiple past clipboards, you need to set the "NumberToPaste" to be a number > 1

Hi JMichaelTX,
Thank you for sharing these macros! I have been doing some testing and have some feedback and questions.

1 - Custom option missing: the “Custom” option is missing from the InsertBetweenPastes drop down list. I added it, but wanted you to know.

2 - DND_POC_CustomDelimiter starts at NULL: other than it’s good to clear variables at the start, is there a reason you started by setting this variable to null? I ask because most of the time, I want the same custom delimiter, so I changed it from null to “%Variable%DND_POC__CustomDelimiter%” so I wouldn’t have to keep typing it in.

3 - Number of delimiters to paste: How would you change it so it only pastes CB-1 delimiters? My delimiter is actually 3 chars: space underscore space. I don’t want the extra delimiter at the end. I’ve tried a few things, but nothing has worked.

Thank you again for the macro!

Thanks for the feedback. I'm made the same change in my copy, and will update the OP soon.

The point was to place your default custom delimiter in that action.

Just add an IF/THEN in the Repeat list using the variable Local__NumberToPaste

HTH.

Please remove #4 from your post, and post as a new topic, since it is a completely different subject.

Ok - I will give that a try. Thanks for the offer to help.

Removed #4 - thanks for the guidance. I'll read up on how to post a new topic - I think I came across instructions on that at some point.

It should be fairly obvious. There is a large button at the top right corner of every page that is a listing of topics:

image

And you can always just use the shortcut of "c" when you are on any page, not in edit mode.

Hi, great macro but how can i get this to work in chrome? Once i paste it only does 1 paste and then it "pauses" if i change the focus to excel it paste the rest.

I'm not sure how you set it up, but it is working fine for me:
Running Google Chrome 69.0.3497.100 (3497.100) on macOS 10.12.6.

image

and then it pasted the following:

One
Two
Three
Four
Five

This macros seems to be amazing but I can't make it work. Really, not one of the steps are working for me. There are so many errors on so many different levels in the process, allthough I read the manual carefully. Is it possible to update it for KM Version 9? If you like to, I could show you all the error-messages.

Sorry to hear that.

I'm running Keyboard Maestro 9.0.4 on macOS 10.14.6 (Mojave), and these macros still work fine for me.

Please post your error messages, screen shots, and the details of a simple example that does not work, and which versions of KM and macOS you are running.

If nothing is working, then please see Troubleshooting -- Something Unexpected is Happening.

This is great!
One issue I am having is I need the pasted txt to be in plain text.
When I add "Filter system keyboard with remove styles" and run
the paste in order macro, it skips my first copied clipboard item.
In other words, if i copy five items, then when I run the macro it
pastes this way: two, three, four, five, five.

I've tried dragging the Filter action to different chains in the macro with no fix.
I am a complete newbie to the program so not sure how to do this.
This is where the added filter action currently sits in the chain:
Screen Shot 2020-04-18 at 2.24.42 PM

I just uploaded a new version that provides an option to paste as PLAIN text.

FYI, here are the key changes I made.
Basically, you set a KM Variable to the Past Clipboard, and then set the System Clipboard to that variable. Since KM Variables contain only plain text, that does the conversion.

Replace This:
image

With This:
image

Awesome! Thanks for the addition, and thanks for the explanation. That makes more sense now.

1 Like