[Solved] How to choose a single item at a time from a list, in an order using siri shortcuts?

I would have a list of URLs. And each time I run the siri shortcut, it should automatically open 1 URL in such a way that it should be in an order 1 after the other. So it should remember what URL was opened last time so accordingly the shortcut would open next URL in the list.

It can be done either remembering the last item or just rearranging the order of the list and then simply opening ‘first/last item’ from the list. I am fine with either of these methods or any other method.

I want this siri shortcut to work in iOS as well as in Mac.

How to make that happen?
I have a list of URLs in this format:

Also if the same mechanism is possible using a csv or text file, it would be fine too.

Or another thing that can work for me is, choosing a random URL. But not choosing same URL twice. Something like this. (In the linked example, it open all items one by one whereas I want to open only one item at a time) and then having some kind of reset mechanism after all URLs from the list are exhausted.

Sounds like you need some persistence to let the shortcut remember what was done before. Have you ever used Data Jar? If you store the list in there, you could modify it each time you run the shortcut and get the desired behaviour.

Off the top of my head, I’d use Data Jar to store the list with each entry as its own dictionary. That way you could store a boolean under each entry to track whether the URL has been opened.

To open a random item, Shortcuts has a “Get Item from List” action that supports getting a random item.

If any of this is helpful, let me know! I can always whip up an example if you need.

I have never used it. I never knew it existed. :smiling_face_with_tear:

Also, I’d be happy to have a free solution. I don’t know what we’re trying to achieve would be doable using the free version of data jar.

I don’t know how to have reset mechanism then. Also, I don’t know how to prevent it from opening the same URL twice.

I am a non-technical person so creating a shortcut all by myself is a considerable task for me :sweat_smile:

What are you trying to achieve? This shortcut seems a bit convoluted. Is the list of URLs changing over time or is it stable?

Here’s a shortcut which I think does the sort of thing you want using just native Shortcuts actions.

https://www.icloud.com/shortcuts/d9d31aa5e1f64193bbf51f8c41a415b6

Hope that helps.

2 Likes

This works.

Thank you so much.

Curious,


What does this action do? Can the shortcut you shared be used for a list of URLs from .txt file?

A little drawback looks like, I’ll have to deal with this popup for every URL whenever I am trying to open it for the first time.

@afriendlypotato It is not going to be stable. I’d be manually adding or removing URLs to/from the list visiting the shortcuts app. If the shortcut I have let’s me use a .txt or .csv file, I can at least avoid visiting the shortcuts app each time to add URLs and set up another shortcut (saved in assistive touch) to append the URLs directly to the .txt or .csv file.

That’s a normal Shortcuts security feature in terms of what the shortcut has access to.

Very nice! I’ll be using that list-chopping trick in the future.