Feature Request: Found Image for Switch/Case

I would love to be able to replace my nested (to death) If the Screen Contains Image actions with Switch/Case. See the partial screenshot of my macro; each border is a previous If/Then in which the current If/Then is the Else.

The why behind my request (if you're interested): Each week I receive between 50 and 200 new song releases from music labels, promoters, and artists. I receive these "promos" via email with links to various sites from which I download the music one track at a time. Sometimes the site in question is a music industry promo management site like Haulix, Fatdrop, or PlayerMPE, and other times it's cloud storage like Dropbox, Google Drive, or Box. Still other times it's a branded site with colors and button labels unique to the record label or promotion firm. In all, there are more than 20 promo distro sites I visit at least once per download day. As you can imagine, it's tedious and time consuming to download these songs one at a time.

I built a few KM macros to help. The main one is a site sniffer that relies on nested If/Then actions with Found Image conditions to determine which site I'm on and then execute the actions to download the music track from that site (usually via Move and Click at Found Image actions). This is bound to a keyboard shortcut for Chrome and to a MetaGrid button on my console iPad. I also have to frequently edit this macro because sites (I'm looking at you, Dropbox grrr) frequently change their UIs, necessitating updating the Found Image screenshots. Navigating through all that nesting and progressively narrower and narrower If/Then actions is a pain in the neck. Case/Switch seems like it would be cleaner and easier to work with.

Hi @iampariah,
If I'm understanding correctly, maybe you can do something like this:

Make as many If-then actions as you like, just make sure to attach a Cancel This Macro action to the true statement.
This way, you don't have to nest so many If-Then actions.

1 Like

Hi, @martin

Thank you. That's so simple, I don't know why I didn't think of it. Not seeing the forest for the trees, maybe.

1 Like

I can't speak for everyone else, but some of us love easy questions.

1 Like

Have you thought about using the SafariURL token to run the logic against contents of the URL instead of the found images condition? I download various PDFs from from a defined set of sources every day and have had better luck with this method. Then the switch/case would work.

That's good "outside the boxes thinking" (pun intended).

@j333sh That's an interesting idea! Thank you. I've only started really getting into Tokens.

I’ve barely scratched the surface. You can also run Switch Case actions against window titles, which seem to translate to tabs for Safari. The URL Token is less error-prone and more flexible since each URL is unique. Then you can run logic on different pages within the same service or website.

2 Likes