Using Chrome tokens (%ChromeTitle%, %ChromeURL%) in a variable?

I'm trying to build a macro that will insert a markdown link built from info from the currently active Chrome tab.

Here's what I've got:

CleanShot 2022-08-16 at 14.08.11

but when I trigger the action in Obsidian, none of the Chrome info is there. Instead, I get:

CleanShot 2022-08-16 at 14.13.15@2x

I'm puzzled because the results preview for the Set variable - local_md_link action appears to be correct -- the webpage's title and URL are interpolated correctly. It's just when I try to do anything with that local_md_link variable do the contents disappear.

Anybody know what's going on?

I don't use Chrome, but assuming you want to include the brackets in the pasted result, this seems to work:

Paste Link & URL.kmmacros (21 KB)

Macro screenshot

It'll be annoying to hear, but a repro of your macro works as advertised for me...

I'd start by simplifying. Delete the first action and change the text in the second to:

Link: [%ChromeTitle%](%ChromeURL%)

...which takes the (unnecessary, unless you're doing something else you haven't shown) variable out of the equation.

1 Like

Good point. I assumed this must have been part of a larger macro, but if not, tokens can be used directly. :+1:t3:

Thanks, Nige & Neil. Things are still broken over here.

I wonder if a security or permission setting is to blame?

I've tried restarting the KM engine, disabling & re-enabling security and access permissions for both the KM app and engine, and rebooting the machine -- all to no avail.

I'm not sure if Chrome has a special permission I need to enable for the KM engine. KM, itself, seems to access the browser info just fine, since it shows up in the preview.

Next I'll see if I can recreate the macro with Safari in order to isolate the problem to Chrome. I'll post back here.

May be worth looking at:

Copy as Markdown Link - Macro Library - Keyboard Maestro Discourse

which copies from Chrome and Safari as well as various other (non-browser) apps.

Try %FrontBrowserURL% and %FrontBrowserTitle% instead and see if that makes a difference.

I've figured it out. The KM Engine didn't have automation permission for Chrome. (In System Preferences > Security & Privacy > Privacy > Automation)

Ticking the box beside Google Chrome did the trick!

CleanShot 2022-08-16 at 16.16.50

Thanks, everybody, for your help

3 Likes