How to maintain formatting in pasted selection?

In Word, using Insert->Links->Link, I can provide it with the URL's for my LinkedIn and GoogleScholar pages, and then get it to represent them using whatever underlined text I choose. The result is this:

09 PM

I can then copy this to my clipboard, and paste it into an Outlook email, creating a nice signature line (the format and functionality is preserved through the copy-paste process—if I then click on either line, I'll be redirected to the appropriate web page). I can likewise paste this into another Word document, to create a signature line for cover letters.

I'd like to create a shortcut that will paste this formatted text. Alas, if I copy this text into KM's "Insert Text by Pasting" action, all the formatting is lost—it's just pasted as plain text. Is there a way to paste this text while maintaining its formatting and functionality?

Sure. Just change the "Insert text by pasting" action to "Insert styled text by pasting":

26 PM

1 Like

Ah, thanks! I had previously looked for that action under "all actions" and couldn't find it, so I figured it was discontinued. But from your screenshot I see that it's actually a sub-action under Insert Styled Text.

1 Like

....the only problem is that it inserts the text twice. I reconfirmed that what I'd pasted into the macro was just a single copy of the text (i.e., that there wasn't some hidden extra material), by returning to the Word document and hitting cmd-V. Screenshot below shows KM macro and resulting pasted text:

That's very odd. Without access to the macro in question there isn't much I can do to figure out why it might be pasting twice, but as an alternative, you could also try using a named clipboard instead. Try going to KM's preferences, make a new named clipboard, and paste the formatted text there:

Then make sure your macro pastes from that clipboard instead of via an Insert Text action:

05 PM

I tried that and that got the same result.

To make sure there wasn't something funny about the text itself that was causing this, I tried copying some plain text from TextEdit (just the word "Hello") into an "Insert styled text by pasting" action. I got the same result—-the text was doubled.

I just tried uploading this macro, but it went here instead of into this post (if you have admin privileges, feel free to delete that post and move the macro here):

Here’s the test macro that just uses “Hello”

Test-Insert Styled Text by Pasting

Test-Insert Styled Text by Pasting.kmmacros (2.1 KB)


Thanks. I actually used your macro to upload it, following the instructions to keep the keys pressed for a long time to insert it into this currently active thread, but it instead inserted the macro into both this thread and into the macro library subforum simultaneously

Your test macro works fine for me, and I can’t see anything about your screenshot that would indicate why that macro would double-paste either. At this point, all I can recommend are some troubleshooting steps:

•Try the Assistance window under the Help menu and choose “Something unexpected is happening…”

•Run a macro that double pastes, then check the KM engine log and see if anything is happening in addition to the macro you just ran. You can find that by going to Help > Open Logs Folder.

•Try quitting the KM engine and relaunching it and see if that solves the issue.

I quit the KM engine and relaunched; no change.

I checked the KM engine log. I only get a single entry for each activation:
Execute macro “Test-Insert Styled Text by Pasting” from trigger The Hot Key ⌥⌘9 is pressed

I’ll try the Assistance window.

I’ll add the only errors I did get were these, obtained after re-launching but before activating any macros:

2018-03-01 00:38:37 Engine Starting 8.1.1
2018-03-01 00:38:37 Invalid Plug In Action with Name Set Finder Label
2018-03-01 00:38:37 Invalid Plug In Action with Name Set Finder Label
2018-03-01 00:38:37 Invalid Plug In Action with Name Set Finder Label
2018-03-01 00:38:37 Invalid Plug In Action with Name Set Finder Label

But these may be more related to the problem I’m having with JMichaelTX’s new Spotlight search macro.