Set Clipboard to RTF Hyperlink & Plain Text MD Link

###Note that I have made a major revision to my original post above to provide the complete, finished, Ver 1.0 release.

I have just uploaded Ver 1.1.

1 Like

Updated original post/download just now with a major revision.

Hi and good day,
Today I’m exploring this neat script.

And it works, the clipboard provides the earlier selected text as a hyperlink of the relevant page.

1.)
HOWever I get an error message:

*** SCRIPT ERROR ***
Action Result: OK
Script Msg: «class bhit»:OK, «class gavu»:false
Macro Aborted.

POSSIBLE CAUSE:
Invalid path or name of Script file.


As far as I can see the path is correct and the name of the script, too.

2.)
Also the context menu, for choosing MD, Plain Text, etc. only appeared the first time/ run, not later.

(I rebooted KM & KM engine)

What could be the reason?

/
with best regards,
Omar KN
Stockholm, Sweden

Hey Omar,

You installed everything where JM specifies?

You DO have the Satimage.osax installed?

-Chris

All 4 items are installed, also Satimage.

All 4 files are in ~/Documents/My KM Data

… or should the .kmmacros files be in a special folder somewhere else?

Here is a screendump: https://d.pr/free/i/Dwf6Xu

So the macro does work, except for the error message, and I rebooted, too.

And also Satimage: https://d.pr/free/i/nuRGyI

/
Any assistance would be fine!

With best regards,
Omar KN

I have not idea why you are getting that error msg -- something has changed with later macOS versions. When I wrote this script I was using Yosemite.

IAC, for now you can either ignore the error msg, or change the Macro Confirmation options from "Full" to "Brief". I'll post an update later to fix.

Added ( return “” --> NEW CODE 2018-03-09 ) to line 306 as acc. to Chris S.

/
okn

1 Like

This is great. Is it possible to set the font and point size as well?

Yes, but you have to change the script:

image

Near the top of the script you should find this line:

property fontStyleStr : "color:blue; font-family:verdana,geneva,sans-serif; font-size:14px;"

This is standard web page CSS styling, so change as you like.

This is an excellent script! Is it possible to copy the Title and URL automatically so it doesn't have a pop up? Then I can just paste into my desired destination.

Hi @James_Hawkins,

This action is there for a reason. It allows you to check the link before pasting it somewhere else. It also allows you to change the format at the last moment.

That said, if you don't need it, you can simply disable this action. But, make sure you set %Variable%DND_SCB__MarkDownType% to your desired format.

1 Like

How do I set %Variable%DND_SCB_MarkDownType% as my desired format exactly? Where do I change this?

Also, is it possible to have this only copy from Microsoft Edge web browser?

Thank you.

You may leave the action I said above enabled and run the macro once. It will remember your choice.

The macro will set the format to MD if you have not set.

It does not really matter as long as you run it only when Edge is the front browser. However, to make the macro run only when Edge is the front browser, put the macro in a macro group and set it to add Microsoft Edge to the list.
image

2 Likes

I seem to have gotten it to work, but why does it create a large two line gap when I paste? I pasted it at the white cursor location and it pastes two lines down.

Screen Shot 2021-10-01 at 5.07.34 PM

I have not used it before and just tried it. It did not add the two blank lines on my side.
I don't know what happened to yours. Did you change anything? If you did, the simplest way might be delete it and reinstall the macro.

1 Like

I ended up making what I needed thanks to troubleshooting with this document. Here is a simplified version of this script for my purpose (auto copy the URL to the clipboard from Microsoft Edge's frontmost window when the page changes title) without a need to have a pop-up. I placed it into a folder that was to trigger with Microsoft Edge only. See attached. It was a lot simpler than what I thought for my purpose.

Grab Microsoft Edge URL.kmmacros (2.8 KB)

That would drive me crazy, because it would interfere with my normal use of copy and paste.

I have a macro with a Hotkey Trigger for Google Chrome, so I can grab a page link at need.

YMMV of course.

-Chris

Yeah it’s a very specific thing that I’m doing where I have to grab a URL and paste it into a document almost immediately. It does still let you copy other things from the webpage after the page loads, like some text on that page for example. Then you can paste it to wherever you want.