Discogs – Editing Releases Shortcut Help

I'm new to KM so pardon me if I don't know what may be obvious.

I'm a frequent contributor to the Discogs database and I'm trying to work out some shortcuts in their release edit section.

First off to get to the release edit page you have to click on Edit Release on the main release pages. This takes you to a History page where you need to click on Edit Release yet again to get to the editor.

I'm trying to build a shortcut that will click on the link Edit Release pause for the next page to load and then click on Edit Release again.

I can't even get that to work you'd think that's the idea behind the action Click Safari Link, but I can't make that work.

It doesn't appear that Frames or Javascript are interfering – but how could you even tell if they were?

Any help would be appreciated.

FYI -You'd have to be signed in as a Discogs user to test this.
Any other Discogs editors here?
Any KM tips for Discogs editing are appreciated.

Cheers.

Hey Leighton,

Please provide a useful start page URL and any relevant screen shots.

Make sure you have JavaScript from AppleEvents turned ON.

image

You may have to enable the Developer menu in Safari's preferences.

-Chris

Thanks for the tip.

I started to click Allow JavaScript from Apple Events, but got a scary warning about being open to malicious code...

When I do allow JavaScript what then would I look for? Would it show in Inspect Element?

Here's a screen shot of a sample release page from:

image

All Discogs release pages have this format in the top right.

I'm starting to think that JavaScript is being employed since this link I want to target "Edit Release" will react differently depending upon if you are logged into Discogs or not.

Ok, I checked this out in Firefox. There is an .js Event Handler on this link.

I'll look at this in more detail later this evening.

In the meantime ignore the scary warning about enabling JavaScript – it's overly paranoid rambling by Apple.

As Peter Lewis (KM developer) is wont to say: "If a malicious intruder is able to make use of this feature they already have enough control of your Mac that JS from AE is the least of your worries.

I'm using the Click Front Browser Link action instead of the Safari action, and I recommend you always do this unless you're running more than one supported web browser at a time.

It makes switching between browsers much more convenient.

Discogs ⇢ Select [Edit Release] link in Discogs display page..kmmacros (5.7 KB)
Keyboard Maestro Export

I copied this XPath using Google Chrome's dev tools, and you can do the same with Safari. Unfortunately Firefox 106.0.5 doesn't produce as compact a descriptor.

This works for me on all pages I've tried so far, although my new membership doesn't let me proceed further (as yet).

You may also notice that the edit link simply adds "#latest" to the original URL.

Original Link:

https://www.discogs.com/release/3710237-Pete-Rugolo-Music-From-Out-Of-Space

Edit Release Link:

https://www.discogs.com/release/3710237-Pete-Rugolo-Music-From-Out-Of-Space#latest

So for this particular task you can always grab the SafariURL Token – massage it to the needed URL and then use Set Safari URL action.

Front-Browser actions/tokens are generally better.

You see the Front Browser pop-up on the right side of the action?

Click that, and you'll get a list of links Keyboard Maestro is able to see. Web coding is complex, and Keyboard Maestro cannot decode everything that's out there, but Peter has a reasonably comprehensive search.

Nevertheless it is sometimes necessary to roll your own with JavaScript actions, and I generally prefer QuerySelector to XPath. I understand it better than XPath.

-Chris

1 Like