How do I fix my Shortcut to act on search results instead of showing them?

Hi there! I’m trying to create a shortcut to archive all drafts that contain a specific word (“temp”, which I use for drafts that can be deleted soon). I’ve got the search part but the result is showing me a list of all the drafts. Is there a way to have it act on all of the drafts that come from the search? I’ve tried adding “Repeat with each item…” in different places in the workflow but it’s not helping.

Thanks in advance for any ideas! Here’s what I have so far…

You are close…you want the “File Draft” action inside the “Repeat with each…”, and have it selected to act on the “Repeat Item”. That is how you create a loop that repeats with each of the results of the search.

Also, be sure to disable “Show when run” on the “File” action if you want it to run in the background.

In the third action, how do you select “Repeat item”? I can’t figure it out. If I click on it, it just shows me a list of draft titles. I’ve tried deleting it and adding it again in the right location, but it’s not picking it up automatically.

You might need to “Clear” the value, since you already had one selected. Then you need to “Select Variable”, and the “Repeat Item” option should be there to click on and select.

Ok that is working perfectly on my mac now - thank you!

On iOS it’s still showing me a list of draft titles to choose from. Any idea why it wouldn’t work the same on the phone?

Are you sure you’re updated sync’d to Shortcuts on your phone? Sounds like it just running the old version still.

Yes - it’s synced. Screenshot below. I have it set up now to run daily via keyboard maestro on the Mac, but it would be nice to do it as an automation on the phone instead.

Are you up-to-date in iOS 16.2 on the phone?

I bet the automation on the iPhone will only work as expected if the iPhone is unlocked so probably leave it on the Mac.

If you’re on the latest versions of Drafts and iOS - the Search term temp is missing in the first action of your shortcut, and you have changed it to search for drafts tagged temp, is this intended?

It actually works fine on the phone after updating iOS to 16.2. @agiletortoise :smile:

I do think I’ll leave it on the mac though so it will run during the day while i’m working. Thank you!

1 Like