Big Sur Upgrade Breaks Previous Chrome Macro

Got a new mac mini and am going to start from a virgin Big Sur install...with 20+ years of mac files to bring forward. "KM, take me away!" I did my export/import and most everything works as before except one complicated script I have...

Some nice forum user, @JMichaelTX ?, wrote a script for me a long time ago that I've used all-day, all the time, since then. Unfortunately, that one has stopped working for me with Big Sur.

Basically, what it does is pulls up a pre-defined website (my Roam database) on a Chrome tab where I have it opened already; regardless of being hidden among other tabs and/or minimized, or not already open. So, if "https://roamresearch.com/#/app/xyzdatabase..." is already active on my computer, command-1 brings it to focus. Pretty basic, right? ...but SOOOO useful.

Here it is:

Quick Open Roam.kmmacros (3.6 KB)

An here is the error I get when I run it now:

Screen Shot 2021-04-24 at 12.47.51

In case anyone is curious, the reason I don't use a simple "open Chrome window with xyz url" is because I want ONLY ONE instance of Roam open at any given time....and I could have already been deep in the database where the URL /gets/really/long/to/get/to/a/specific/page/.

FYI. I do have a few of those and they survived the import and work just fine on the new MacOS.

Screen Shot 2021-04-24 at 13.35.30 f

Anyone have any ideas? FYI. I would also like to use a similar kind of script to drill into deep links with web apps like Gmail, Evernote, MailChimp, Google Analytics (dare I dream!?), etc. Unfortunately, I only understand about 50% of the script as it's written....so if there's a simpler way to accomplish the same effect, talk to me!

(Running KM Version 9.2)

Merci, from Paris !

Hey Bernard,

Chances are that you have not enabled this setting in Google Chrome:

image

-Chris

Voilà! That was it. Thanks so much, @ccstone.

@ccstone
Ok, well it worked for a couple days...but now i'm getting the exact same error again. The "Allow JavaScript from Apple Events" is (still) checked this time so what else could it be?
As always, merci in advance to anyone who can help.
— BJ

Hey Bernard,

There's no good way to fix this without being able to reproduce the error, and neither I nor @JMichaelTX have access to an M1 Mac at present.

System Events is apparently NOT finding the correct window by window index, as the error is stating window 5 does not exist.

The question is whether this is a B.S. bug or a Chrome for B.S. bug.

Try this macro. I've taken a different approach than JM, so it might work.

If not then you've got an “interesting” debugging job in front of you.

-Chris


Quick Open- 1 Roam Research @ccstone v1.00.kmmacros (3.8 KB)

1 Like

Bonjour, Chris !

I've installed your macro and it's working exactly as I would want it to. P.S. I'm not sure JM wrote the other one—it could have been you now that i think about it! Anyway...

I learned Apple BASIC in 1984 on a computer like this so I "sorta" understood your code...but from what I can tell, it's delicious. That thing you did on line 56 was an epiphany. If it keeps working, there are SO many possibilities for it... :exploding_head: :bangbang:

BTW, what language do i need to learn to have a macro like that in my head and could i make money learning it?

Thanks so much!

:cowboy_hat_face:

Hey Bernard,

This is just AppleScript, and unfortunately not all apps support AppleScript.

Thankfully many do, and AppleScript UI-Scripting is also available to help with unscriptable apps.

Can you make money writing AppleScript? Yes.

It it easy to do? No.

-Chris

1 Like