Update 2020-02-01: It looks like Tesla have deprecated their authentication endpoint so these shortcuts won’t work for new users. I’m working to update the shortcuts to support Tesla’s new authentication flow. Existing users who have already generated token information can continue to use them until their access token expires.
Scriptable popped up on my radar not long after the release of iOS 14 due to its rich support for widgets. Scripts have complete control over the widget’s appearance and can present whatever information you’d like. Scriptable even refreshes widgets in the background so they can be kept up-to-date.
I recently purchased a Tesla Model 3 and have been tinkering with the Tesla API in Shortcuts. (Although this is Tesla’s API, it’s not officially available to third-parties. The Tesla community has been reverse-engineering and documenting it for years). This was also a good opportunity to learn more about Scriptable.
Tesla’s API requires an access token for authentication. One of the shortcutsgenerates this token using your Tesla login credentials, then saves it to iCloud Drive for all shortcuts to reference. Your password is not saved at any point and is only used to create the token with Tesla’s API.
One notable feature of both the shortcuts and scripts is that, where necessary, it automatically converts distance and temperature based on your car’s preferred units of measurement. Tesla’s API uses miles and Celsius, an oddly British combination of metric and imperial, so any conversion is done for kilometers and Fahrenheit automatically.
I plan to spend more time with Scriptable and have set up a GitHub repository for my scripts.
Update 2020-12-20: I’ve updated all of the Tesla shortcuts to resolve an issue where they may try to look for a “Tesla Auth” shortcut. This was the original name for the Tesla Settings shortcut before release. The shortcuts had been updated but, for some reason, Shortcuts would override that.
I’ve since recreated the Tesla Settings shortcut and updated the rest to use this. If you’ve tried using these shortcuts, I recommend deleting them and downloading them again. You won’t need to generate a new access token if you already have one as these shortcuts will use the existing information.
Shortcuts has gained plenty of features and functionality over the years, especially after Apple’s acquisition of Workflow, but how shortcuts are created and organized has remained almost unchanged since the app first launched back in 2015.
As a result, creating shortcuts like Mocktail is a painstaking and frustrating process. The app simply hasn’t scaled with the increasingly complex uses for shortcuts and the interface is still skewed towards simple shortcuts made up of only a few actions.
After spending what felt like an eternity updating Mocktail, I’ve come up with a wishlist of ten improvements I’d love to see in Shortcuts.
Shortcuts desperately needs a way to copy and paste actions across shortcuts—it’s almost criminal that it doesn’t have it already. There’s simply no way to reuse a set of actions from one shortcut in another or even just duplicate actions within the composer.
As I rewrote parts of Mocktail, I made use of a separate iPad to view a set of actions I had created in another shortcut, then manually add them to the shortcut I was working on.
Backup and versioning
There’s no way to easily back up shortcuts, which feels like a regression and something that was possible with Workflow (i.e., saving workflows as files). iCloud syncing helps keep devices in sync but it’s not a backup tool. I often duplicate shortcuts at various stages of development (Mocktail 1, Mocktail 2, Mocktail 3, etc.), all of which clutter the app.
One workaround is to create a shortcut that contains the Get My Shortcuts and the Get Link to File actions to create an iCloud link for every shortcut. This is time consuming as a new iCloud link is generated every time it’s run and the more shortcuts you have, the longer it takes.
A feature I’d really like to see is a macOS Time Machine approach to backups that supports versioning. I’ve lost count of how many times I’ve started to make changes to a shortcut, only to realize I want to revert some of my changes. I can’t do that and, unless I’ve duplicated the shortcut at a specific point in time, it’s too late. Being able to create a snapshot of a shortcut—or more easily back it up without the need to create an iCloud link—is something that’s sorely needed.
Share shortcuts as files
As I mentioned above, Workflow previously supported sharing workflows as files. I used this extensively and it made hosting my workflows on GitHub possible—I didn’t have to rely on web links to share them. This also made it easy to back up workflows. At one time, I had a very simple workflow that would create a timestamped folder of all my workflows on iCloud Drive.
Shortcuts, however, cannot be shared as files and the only option is to create iCloud links. I understand the security concerns here and, honestly, I don’t see this feature ever returning. Nonetheless, it still something I wish it supported… again.
Revamped organization of shortcuts
Despite Shortcuts and Workflow improving significantly over the years, the way shortcuts are organized has barely changed. The most notable improvements I can think of were the addition of search and the ability to tap the Shortcuts button to jump to either the top or bottom of the list.
No way of grouping or organizing shortcuts is a significant user experience problem, one that gets worse the longer you use the app. Many of us seasoned Shortcuts users can easily have over 100 shortcuts, especially if you’re duplicating because there’s no versioning or backup support. Some form of navigable grouping, whether through folders or tags, for example, would improve things significantly.
Shortcuts technically supports this in some fashion as a shortcut can run another shortcut within itself by using the Run Shortcut action. But to do this, another shortcut has to exist. This is problematic for two reasons:
You can’t share just the main shortcut, you have to also share any other shortcuts it references or else it won’t work.
It’s not something that scales well. The more shortcuts you create like this, the more cluttered Shortcuts becomes (there’s a theme about organization developing here).
I have a few shortcuts for image manipulation and each one runs additional shortcuts to resize and optimize the images (using TinyPNG) passed to it. I’d much rather have a subroutine for optimizing images with TinyPNG than a normal shortcut that isn’t used independently.
Subroutines could be mini-shortcuts that don’t exist within the standard set of shortcuts, instead they could be accessed like actions. Sharing a shortcut should also include a full copy of the subroutine. This type of reuse would, I think, be highly useful.
There are times during shortcut development that I’d like to stop or pause a shortcut at a particular place. I currently do this with the Show Alert action but would prefer an option to do this without having to tap cancel.
Beyond this, having the ability to pause a shortcut, see what the input and output of the previous action, and even changing subsequent actions before resuming would rapidly speed up my work.
Sometimes I just need a shortcut for a one-off task or I want to try something out. This slowly results in a litter of untitled shortcuts that are either empty or were needed only once. Although Shortcuts does provide an option to either save or delete shortcuts that haven’t yet been named, I wish there was a sandbox for these quick one-off needs instead of creating a new shortcut first. Once I’m finished, I could then choose to save the shortcut or just clear the sandbox.
Improved dictionary support
Dictionary support is pretty good in Shortcuts but it’s hindered by limited functionality and a lack of flexibility. I’d like to see things like:
a collapsible tree view for nested dictionaries.
the ability to copy and paste keys and values.
an option to populate or load a dictionary from a JSON file.
Exit to home screen
The Exit Shortcut action is limited to stopping the current shortcut and then dismissing it. This is fine but sometimes I run a shortcut and would prefer an option to exit the app entirely and return to the Home screen.
Don’t show in Widget by default
Oh boy, do I hate this behavior. I’ve stopped using the Widget entirely because it’s full of duplicate shortcuts. Perhaps this wouldn’t be so bad if there was a better way to back up and version shortcuts?
One of my favorite features of Workflow was its ability to share workflows as files. It was this functionality that made it possible for me to start Workflow Directory and create my own GitHub repository of workflows. Unfortunately, Shortcuts doesn’t support this functionality and I suspect it never will again.
Although it’s possible to jump through some hoops to import workflow or shortcut files, lack of file support makes it impossible to maintain my GitHub repository. Instead, I’ve started the long overdue process of creating iCloud links to my shortcuts and publishing them here instead.
All of my shortcuts are being made available on my site and can be found at a dedicated Shortcuts page. Although I’ve written about some of them in more detail, there are plenty of shortcuts I’ve never blogged about. I will publish any shortcuts I think are useful and continue to write about some of them in more detail.
I’m also using this opportunity to clean up my shortcuts, fix any broken ones, and remove any that are no longer functional. I’ve already gone through my blog posts to update them all with iCloud links and have identified a few that rely on APIs or functionality that’s no longer available (e.g., all my IFTTT-based workflows can’t be used anymore).
I’ve been having some troublesome sync issues with Shortcuts since upgrading to iOS 13. None of my devices would stay in sync and shortcuts I’d delete would reappear moments later. In some cases, shortcuts would even be duplicated.
A helpful tip on the Shortcuts subreddit has provided a simple solution for my syncing woes: delete the app and reinstall it. I did this on each of my devices and now shortcuts sync perfectly.
My iPhone photography workflow includes sharing some of the photos I’ve taken to Instagram. I usually include relevant hashtags to increase discoverability and have a collection of frequently used hashtag sets—different hashtags for the same topic—that I can choose from. I also include a five-dot prefix (each dot on a separate line) to separate the photo’s caption text and hashtags. This is a commonly used method for hiding hashtags “below the fold” so they’re only visible when tapping the more button.
I’ve used a few different methods for managing my hashtag collection and wanted to share my experiences with each.
iOS text replacement
iOS has built-in text substitution that can be used to replace a shortcut with a longer piece of text. For example, a shortcut of ,,iphone could be replaced with #shotoniphone #iphonexs #iphonephotography.
Text replacement is a good option if you occasionally use hashtag sets. You can easily add them to an Instagram caption without leaving the app. It’s basic organization and need for you to remember what shortcuts you’ve created isn’t well suited for more frequent users or those with a larger collection.
Copied is a clipboard manager app for iOS and was the first standalone app I used for managing hashtag sets. Each set can be saved a separate clipping and accessed directly from Instagram using Copied’s custom keyboard.
Clippings can be organized into lists and the custom keyboard also includes a built-in search, both of which make Copied useful if you have a lot of hashtag sets.
The popular iOS photo editor has built-in support for hashtag set management. Darkroom makes it easy to manage and create new hashtag sets and provides some useful ways of accessing them.
Hashtag sets can be selected and copied to the clipboard—along with an optional five-dot prefix—as part of the photo export flow so that you can switch to Instagram and simply paste the hashtags in. You can also use Darkroom’s Today View widget to select and copy hashtag sets to the clipboard.
The app also supports Siri shortcuts for quick access to hashtag sets. You can select which hashtag sets to include and then record a phrase to use with Siri. Once invoked, the hashtag sets are copied to the clipboard.
My preferred method for managing hashtag sets nowadays is, unsurprisingly, with a shortcut. I created Instagram Hashtag Sets to manage my hashtag collection and use them whenever I post a photo to Instagram. The shortcut is more flexible than other methods I’ve tried and also includes some additional functionality.
It can be run as a normal shortcut or from the Share Sheet, the Shortcuts Widget, the Home screen, or as a Siri Shortcut. I primarily use the Share Sheet by selecting the caption text I’ve specified and tapping Share; the shortcut includes the caption text when it copies hashtags to the clipboard to make it easier to simply paste it over the existing text.
The shortcut contains a dictionary of my hashtag sets, each of which is an array of hashtags. When run, it displays a list of these hashtag sets for you to select from. All of the chosen hashtags are copied to the clipboard, after which it switches back to Instagram and displays a notification. The shortcut also includes support for a five-dot prefix and includes this if the option is enabled.
Instagram limits the number of hashtags per photo to 30. The shortcut counts how many hashtags have been included across all hashtag sets and allows you to deselect individual hashtags if there are more than 30. The shortcut also repeats the check until there are 30 or fewer hashtags.
Shortcuts no longer supports shortcut file imports. Any links to shortcuts in this post have been updated to use iCloud links.
Update 2020-05-04: Mocktail has been updated and is now available on my site—it is no longer hosted on GitHub.
I last updated my shortcut for creating device-framed screenshots in December 2017 by adding support for iPhone X. I’ve been meaning to add more device frames for a while now but, since becoming a father six months ago, free time has been a precious commodity.
In the meantime, Federico Viticci released his impressive Apple Frames shortcut which does a fantastic job at framing screenshots for different devices. I still wanted to update my shortcut though it now seemed redundant to simply add more frames. Instead, I decided to start from scratch and approach the concept of screenshot framing differently.
My original shortcut, like Federico’s, makes use of Apple’s marketing product images—high-resolution images of devices for use in marketing or promotional material—that are ideal for screenshot framing. However, there’s no variety in what’s available, only flat images of devices and usually in Space Gray.
Instead of framing screenshots using just these images, I wanted to create mockups using different product images that are more distinctive and, in some cases, three-dimensional. The result is Mocktail, a shortcut that creates framed iOS screenshots using various device images I’ve sourced from Apple’s website (e.g., product landing pages or the online store). Where necessary, Mocktail applies perspective distortion to screenshots using Cloudinary, an online image manipulation API.
Mocktail creates mockups for the following devices:
Notably absent is the iPhone XR. There aren’t yet any usable images of the device to create mockups with (the only ones I could find aren’t a high enough resolution) nor has Apple created a product marketing image for it. I hope to support the iPhone XR sometime in the future.
Using the shortcut
Mocktail can be run as a normal shortcut, accepts images from the share sheet2, or using drag-and-drop, and performs the following steps:
Checks if any images were shared to the shortcut via the share sheet (or using drag-and-drop). If not, the shortcut displays a list of recent screenshots for you to select from. Multiple images can be shared to create a batch of mockups all at once.
Checks that the required base images are available in iCloud Drive. If not (i.e., the shortcut is run for the first time), they are automatically downloaded and saved3. The shortcut then continues.
Calculates the pixel count of the screenshot by multiplying its width and height. This is used to determine what device the screenshot was taken on.
Determines the orientation of the screenshot (either landscape or portrait).
Using the device information and orientation, the shortcut displays a list of suitable base images for you to select from.
Applies rounded corners if the device requires it (e.g., iPad Pro or iPhone XS). For iPhone XS and XS Max, a notch is also added to the screenshot.
For flat base images, the screenshot is overlaid onto the base image. For three-dimensional base images, Mocktail uses Cloudinary to apply perspective distortion to the screenshot, then overlays it onto the base image.
Certain base images have a significant amount of white space. Where necessary, the shortcut crops the completed mockup.
The completed mockup is saved to iCloud Drive. Each mockup is saved in a folder corresponding to the name of the device, such as /Shortcuts/Mocktail/iPhone XS Max.
Distorting images with Cloudinary
Mocktail uses Cloudinary’s upload and image manipulation APIs to apply perspective distortion to screenshots. You need to create a free Cloudinary account to use Mocktail. The free pricing tier is more than sufficient as you would need to run this shortcut several thousand times a month before you would exceed the free plan.
When you first launch the shortcut, it asks you to provide the following information about your Cloudinary account which can be found in the Dashboard:
Username (your Cloudinary “cloud name”, not email address)
By default, Cloudinary requires uploads to be signed with the account’s secret key. Mocktail doesn’t do this so you need to enable unsigned uploads and specify the upload preset in the shortcut. This randomly generated value is used to upload images without needing to sign them4.
Once you have provided your Cloudinary details, you can begin using Mocktail to generate mockups.
Mocktail is one of the most complex shortcuts I’ve created and it makes extensive use of dictionaries to store information. To figure out how screenshots should be distorted, I used Affinity Photo to draw lines along the sides of the display. I then added horizontal and vertical guides at the location where these lines intersected, providing me with the necessary X,Y coordinates required by Cloudinary.
Mocktail is available from my GitHub repository of shortcuts. I prefer not to use iCloud links when sharing shortcuts because of they’re one-time use limitation. Rather than generate a new link every time I update the shortcut, I can push an update to GitHub and the existing link still works (there’s also the usual benefits of using a version control system).
Both iPad and iPad mini are the same resolution so iPad mini screenshots are handled as iPad screenshots—there are no iPad mini-specific base images. ↩
At the time of writing, the current version of Shortcuts—2.1.3—has a bug that can prevent image-based action extension shortcuts from working. If Mocktail doesn’t work from the share sheet, run it from within the app. iPad users can also drag-and-drop images into the shortcut. ↩
Federico cleverly uses Base64 encoding to store all images as text within his shortcut. I decided against a similar method because it seemed to severely impact the performance of Shortcuts. Instead, the base images are made available as a ZIP file in my repository that the shortcut downloads and extracts. ↩
Signing uploads would have been a more significant undertaking. I don’t think it’s necessary considering the use case. ↩
Our two-month-old daughter is formula fed. My wife and I prepare a batch of bottles every day using this formula mixing pitcher so they’re readily available at feeding time. Some arithmetic is needed to work out how much formula powder to add to a certain volume of water, and the amount of formula we need to prepare steadily increases as she grows. To give our sleep-deprived brains a break and avoid any miscalculations, I created some shortcuts to help out and do the math for us.
Formula Calculator works out how much formula we should prepare for the day, based on our daughter’s current weight (in pounds and ounces). The general rule of thumb for babies up to six months old is to offer 2.5 ounces of formula per pound of body weight in a 24 hour period. Her weight is entered when running the shortcut, along with how many feeding sessions to expect that day 1. The amount of formula to prepare, along with how much to fill each bottle with, is then displayed.
This next shortcut, Formula Prep, is the one I use the most. It calculates how much formula powder to add to a specified amount of water. Most formula powder in the US specifies one scoop (8.7g) of powder for every 2 fluid ounces of water. I specify how much water is in the pitcher and it calculates the amount formula powder to add—both in grams and scoops. I prefer to measure by weight as it’s all too easy to lose count of the scoops being added.
Prepared formula can be stored in the refrigerator for up to 24 hours. After that, it must be discarded. Formula Reminder is a shortcut I run once I’ve prepared formula that creates a reminder with an alarm set 24 hours later.
The number of feeding sessions can vary from day to day. We’ve been tracking our daughter’s feeds since birth and she’s currently averaging about six sessions per day. ↩
Once again, Workflow to the rescue! I’ve created this workflow for publishing microposts on my Jekyll-powered blog that can also include photos. Instead of relying on the Micropub to GitHub service, it uses GitHub’s API to directly upload and commit the micropost–and attached photos–to my blog’s repository. This automatically triggers a site deploy on Netlify, making the new micropost and photos available a few moments later.
When run, the workflow does the following:
Prompts me to write a new micropost.
If the workflow was not run as an action extension, it asks if I want to add any photos (the workflow checks if any photos were shared when run). I can then select photos from my library.
Resizes all photos to 1000px wide. Photos that are already smaller than 1000px are not resized. I don’t want to share full-size photos, so reducing the size suits my needs.
Asks me to confirm or change the file name for each photo.
Uploads the photos to my GitHub repository and commits the changes, triggering a deploy with Netlify.
Creates the micropost text file with the composed text and current date. If photos have been included, Markdown-formatted photo links are added at the end of the text file. This text file is uploaded and to GitHub and committed. Netlify then does another deploy, making the post available.
Although I created this workflow primarily as a way to publish photos, I can also use it to quickly publish text-only microposts. What’s more, I can even dictate new microposts and publish them straight from my Apple Watch.
If you wish to customize the workflow, change the following parameters in the Dictionary action at the top of the workflow:
token: A GitHub token that has read/write access to your repositories.
username: Your GitHub username.
repo: Your site’s Repository.
directory: The directory to save images to.
site_url: The URL to the website.
post_dir: The directory where micropost text files should be saved to.
The configuration options have been created based upon my implementation of microposts. Depending on how (and where) you publish microposts, you might need to make some additional changes to the workflow.
Shortcuts no longer supports shortcut file imports and workflow.is links no longer function. Any links to shortcuts in this post have been updated to use iCloud links.
I recently added a Nespresso machine to my growing collection of coffee paraphernalia. It arrived with a selection of some of the 26 varieties available in the OriginalLine range—each one has a different strength (intensity) and cup size (ristretto, espresso, or lungo).
However, there’s no way to know this information just by looking at the capsule as it only has the name printed on it. To know more, one needs to either keep the packaging, refer to the website, or have this information memorized. There is a Nespresso iOS app available, but it’s not easy to quickly find a capsule and get its strength and cup size.
This seemed like a good opportunity to explore Workflow’s Dictionary functionality, a feature I hadn’t really used before. I created this Nespresso Capsule Information workflow to look up the intensity and cup size for any Nespresso capsule. To make it a little more interesting, capsule information can be retrieved by selecting either its name or an image of it.
All of the capsule data is stored within a Dictionary action inside the workflow. I created a Base64-encoded archive of all capsule images and included it as a Text action in the workflow (that’s what the nonsensical first action is). This is decoded and extracted when running the workflow, so no images need to be separately copied or installed anywhere—allowing the the workflow to be entirely self-contained.