Creating an iOS Shortcut to manage your social media usage, play a specific song, and keep track of app launches is a fun and creative approach. Here's how you can do this using the iOS Shortcuts app:
Step 1: Prevent Music Overlap
-
Stop Any Currently Playing Music:
- Add the "Play/Pause" action and set it to "Pause" as the first step. This ensures any currently playing music is stopped before starting "Determination."
-
Play "Determination" by Toby Fox:
- Add the "Play Music" action and select "Determination" from your music library.
Step 2: Set Up a Launch Counter
To keep track of how many times you have opened the app, you'll need to use a workaround since Shortcuts doesn't natively support persistent variables. We can use a file or an iOS Note to store this data.
Option A: Using Files
-
Get Contents of File:
- Use the "Get File" action to retrieve a stored counter from a file in iCloud Drive. Initialize this file with
0 on your first run if it doesn't exist.
-
Increment the Counter:
- Use "Calculate" to add 1 to the current value of the counter.
-
Save the Counter:
- Use "Save File" to overwrite the existing file with the new counter value. Set the option to replace the existing file.
Option B: Using Notes (Simpler for Text Storage)
-
Extract the Counter:
- Use "Find Notes" and "Get Note" to retrieve a note that contains your counter. Parse the note to extract the current number.
-
Increment the Counter:
- Use a "Calculate" action to add 1 to this value.
-
Update the Note:
- Use the "Append to Note" or "Create Note" action to update this note with the new counter value. Ideally, you overwrite the existing content with the new number.
Step 3: Track Time Since Last Launch
-
Record the Current Time:
- Use the "Get Current Date" action to get the current date and time.
-
Calculate Time Difference:
- Retrieve the last timestamp from your storage method (either file or note).
- Use a "Calculate" or "Get Time Between Dates" action to find out how much time has passed since the app was last accessed.
-
Save the New Timestamp:
- Update your note or file with the new current timestamp for future reference.
Example Setup for a Shortcut
In Shortcuts, this would look something like:
- Pause Current Music
- Play "Determination"
- Retrieve and parse your counter from storage
- Increment the counter
- Save the updated counter back
- Retrieve the last timestamp
- Calculate the time elapsed
- Save the current timestamp for next time
Testing and Optimization
- Test the Shortcut: Run your Shortcut manually to ensure it operates correctly and updates both the counter and timestamp.
- Add a Notification: Consider adding a "Show Notification" action to alert you about how long it's been since your last launch.
Keep in mind you may need to adjust permissions and ensure that your files or notes are set up correctly so that they are accessible by the Shortcut each time it runs. This setup requires a bit of manual management but should meet your need for a creative deterrent for social media use!