Any way to restore previous version of an iOS/Mac shortcut

Looks like a saved a shortcut, not realizing I had deleted an action with a regex pattern that took forever to hone. Now the change has propagated to all my devices, and I can’t find a way to restore the previous version.

Is all hope lost, or is there a way to retrieve an older version?

-rf

On a Mac maybe Time Machine has an older version?

4 Likes

Find the folder where your Shortcut was stored on a Mac and look for older versions in Time Machine.

2 Likes

Okay by where are shortcuts stored in the file system? I’m talking shortcuts as in Workflows created in the Shortcuts app, not an application link/shortcut. (God i wish Apple had stuck with Workflows and not switched terminology to something confusing and impossible to google for)

This guy says they are in a database in your ~/Library/Shortcuts folder and there are indeed SQLite files at that location.

1 Like

See recommendations of tools from MPU forum members for peeking into SQL databases.

Today I also accidentally deleted a very important Shortcut (the one I daily use to turn off my alarm clock) that would be rather hard to recreate from scratch, since it contains an inline Scriptable script which executes a PUT request to a specific URL with a specific body and I did not have that documented anywhere… :person_facepalming:

Many kudos to @MevetS and @karlnyhus for enabling me to quickly get that crucial info back, because they mentioned Time Machine and the location of Shortcuts in this topic! :heart:

In case it will help someone else (possibly even me) in the future, here’s a summary of what I did:

  1. Navigate to ~/Library/Shortcuts of a previous date in Time Machine
  2. Copy that entire Shortcuts folder to another location
  3. Open the Shortcuts.sqlite file in that location in DB Browser for SQLite
  4. Select “Browse Data”
  5. Select table ZSHORTCUTACTIONS
  6. Search for the name of the Shortcut (which is unique in my case)
  7. Tap on the BLOB entry under header ZDATA for the search result (unique, so single line)
  8. Copy the textual representation of the binary hex data in the Edit Database Cell pane on the right
  9. Paste it in an editor (I used Visual Studio Code), clean it up
  10. Profit! :tada: (the text contains the entire JavaScript code used in the Scriptable script)

PS: This will not help in restoring any random shortcut, but because I only needed the JavaScript “text” this worked for me :smile:

4 Likes