Table of contents
Beginner Questions
- What are shortcuts?
Apple shortcuts are predefined series of commands that can be configured on all Apple Systems, iOS, MacOS, iPadOS, and watchOS.
Apple shortcuts make use of internal or x-callback URLs to add, delete, modify system or app data.
- I use Automator on MacOS, do I need Shortcuts?
Automator is generally more powerful than Shortcuts and has built-in initiation options that Shortcuts do not.
However, if you want your automations to be accessible on both your phone and laptop, Shortcuts may be a better fit.
- But but, I am on Android. (Update Oct 20, 2023, so am I!)
Then use Automate by LlamaLabs (https://llamalab.com/automate/)
Yes, tasker is the "more popular" alternative, but in terms of UI/UX, Automate is the closest option you will find.
Flexible is one thing Apple Shortcuts tries to be not. It will fight you every step of the way.
So, we will go over the functions that Shortcuts provide out of box. And the quirks that come along with it.
Primitives
- Constants and Variables
Shortcuts has inbuilt constants in form of Text, Number, Boolean, Array and Dictionary.
All objects are immutable in Shortcuts, i.e., changing any of these constants (mostly) returns a new object, rather than changing the original object.
- Operators
Any programming language has 5 basic operators:
(a) Equals
(b) Not
(c) And
(d) Or
(e) ContainsShortcuts has TWO: EQUALS/Not EQUALS and CONTAINS/Not CONTAINS.
Remember this!
- Conditionals
Usually comparisons can have multi-parts in normal programming languages:
and
oror
.But we just learnt that shortcuts do not have
and
or
as discussed above.So,
if X or Y: i1 else: i2
in Shortcuts isif X: (i1 if Y: i1 otherwise: i2) otherwise: i2
- Loops
You might be used to 4 kinds of loops: for range, for each, for until and while. You might also be used to 2 commands: break and continue when dealing with loops.
Shortcuts only has TWO: For range (ex: run it 100 times), or For each (ex: run for each element in array)
- Inbuilt Objects
Shortcuts also comes with an inbuilt set of objects. Each of these objects have pre-defined properties:
- There are 22 inbuilt objects.
- Each object has different inbuilt properties.
- Depending on the object, it presents with a set of conditionals.
Images of all objects and their respective propertiesInbuilt Object Conversions- You can define that the object is a dictionary, boolean, number and text but you cannot define it is an array.
- Object conversions also have no warning. So, you can try converting a URL into a dictionary and you'll know only when you run it!