Shortcuts is complicated and yet cannot do the simplest things

I want to create a shortcut automation that plays music if I stop two alarms.


I was planning on using a count. And using this structure:

-if alarm stopped add 1 to count

-if count >=2 play music & end shortcut

-repeat


but I cannot figure out how to create a variable and set it’s value to 2. Or how to count at all.


very frustrating that this app cannot easily do the most basic things.

iPhone 11

Posted on Jul 10, 2024 10:36 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 11, 2024 12:56 AM

In Shortcuts, variables don't save between runs. So variables are reset once the shortcut ends.


The solution is to take advantage of files. Use the "Save File" action with the "Ask Where To Save" option disabled to save the count and "Get File from Folder" action to get the count.


Try searching the "Toggle Switch Control" and peek in the scripting. When you first run that shortcut, it will show you a prompt about Switch Control and once you (hopefully) get used to it, it will stop showing the prompt after subsequent runs.


Regarding the counting, the "Add to Variable" action adds extra items, thus turning the stored data into a list. If you want to increment the counter, try the "Calculate" action.

Similar questions

1 reply
Question marked as Top-ranking reply

Jul 11, 2024 12:56 AM in response to Taylorl567

In Shortcuts, variables don't save between runs. So variables are reset once the shortcut ends.


The solution is to take advantage of files. Use the "Save File" action with the "Ask Where To Save" option disabled to save the count and "Get File from Folder" action to get the count.


Try searching the "Toggle Switch Control" and peek in the scripting. When you first run that shortcut, it will show you a prompt about Switch Control and once you (hopefully) get used to it, it will stop showing the prompt after subsequent runs.


Regarding the counting, the "Add to Variable" action adds extra items, thus turning the stored data into a list. If you want to increment the counter, try the "Calculate" action.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Shortcuts is complicated and yet cannot do the simplest things

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.