I can't get this same macro to run in Safari to save my life. I downloaded someone's working macros to use on Roam Research, so they've been vetted. Keyboard Maestro says the %FrontBrowserTitle% is empty. I've tried switching it to the SafariTitle = no luck. I've made sure JavaScripts are enabled and I've restarted my computer, Keyboard Maestro, etc. I'm running Mac OS Monterey. Help! Thanks.
Update: by Googling I got Allow Javascript from Apple Events to work with Monterey, and my %FrontBrowserTitle% field is no longer empty. However, I cannot get the data to paste into Roam. I've looked at the Creating Roam Templates doc but it's not helpful, and I'm currently searching on YouTube, but I'm stuck. Thanks
This is what I get from Interactive Help:
The macro “Roam Link” has fired 2 times.
Since the macro was triggered, you know that it is running the actions. If you are still not getting the results you want, you need to look at the actions you are using. Some common issues you might run in to include:
Is the target application ready to receive the events?
Do you need to add a Pause action to wait for the system to be ready?
If you are using a Click Mouse action, turn off the Restore Mouse Location flag and verify the mouse is going to the expected location.
If you are using a script action, make sure you are displaying the results, including any errors.
If you are still having troubles, post your question in the Keyboard Maestro Forum.
Can't manually paste, or can't paste using a KM macro? If the latter, it'll help if you upload the macro so we can see what's happening -- How to Post/Upload your Macros and Scripts.
You can then manually ⌘V to paste into Roam. You could script this further by including a "Paste" action etc, but what you need will depend on your workflow -- "I've already found the web page I want, Roam is active and I have the insertion point in the right place -- paste in the link" is different to "I'm in my browser and want to add the current page to the end of the Roam document My Links".
But the great thing about KM is that you can start with something simple like the above, get it working, find the way to use it that suits you, and easily add actions to make that happen.
The purpose of the macro is correct for what I want. I want to capture both the front page URL - and the URL document title - without having to manually position the insertion point. I’m trying to capture the reference data for research, so I need both. So how to make this macro work for that purpose? The macro was in a file I downloaded from a web article about Evergreens/Zettlekasten by Maggie Appleton, and it works for her research. The macro runs, the problem issue is with my Apple system, it doesn’t paste into the destination site, my Roam Research page. How to fix this? There is something wrong at the end of the macro.
In the macro you posted the first nine actions are all concerned with collecting the front browser window title and URL and creating a Markdown link. All nine can be replaced with the single action I posted, which is literally:
"Set the clipboard to a [, then the front browser window's title, then a ] and a (, then the front browser window's URL, then a )."
Running it when this page is active gets me:
[Can't get FrontBrowserTitle to work - Questions & Suggestions - Keyboard Maestro Discourse](https://forum.keyboardmaestro.com/t/cant-get-frontbrowsertitle-to-work/25789/12)
...which should be exactly what you need. And you can run it without leaving Roam.
You finish your macro with a Notification. Great, you can see what the clipboard is set to. But at no point in your macro is there a "Paste" action -- so your text stays on the clipboard. You could manually paste the text into Roam, you could add a "Paste" action, or a "Type a Keystroke" action with ⌘V. Which you choose will depend on your workflow and what Roam will accept -- so try some things and see what works for you and the way you like to do things.
Oohhh. Got it! It works. I added a Paste from Named Clipboard action as opposed to messing with the rest of the macro, or adding an extra keystroke, but I may revisit your sound advice and simplify. Thanks alot for solving my problem.