The Shortcuts app in iOS 12 seems really powerful, comparable to a minimal weakly-typed scripting language. So I'm wondering whether there is an AppleScript-like way to program it, instead of dragging and dropping those blocks.<p>If not, will anyone be interested in some sort of tool that converts source code (in, say, a subset of Python or Bash) to Shortcuts program?
I just did some sleuthing and it looks like you can create a shortcut using XML. :)<p>You can reverse engineer the format by creating an iCloud link to a shortcut. There's a JSON payload that that the shortcut permalink page requests. That payload contains a link to a binary plist which can be translated into XML (`plistutil -i shortcut.plist`).<p>Here's one I just generated that expands shortened URLs: <a href="https://gist.github.com/dlo/1217af3b86f363faf578aa23408c19ef" rel="nofollow">https://gist.github.com/dlo/1217af3b86f363faf578aa23408c19ef</a><p>After you write your shortcut, encode it in binary plist format (using plistutil), and then upload that blob to a URL. Use the following scheme to import it into Shortcuts.app:<p><pre><code> workflow://import-workflow/?name=URL20%Expander&url=encodedUrl
</code></pre>
Hope this helps!
I just started working on this library, maybe it can be helpful :)<p><a href="https://github.com/alexander-akhmetov/python-shortcuts" rel="nofollow">https://github.com/alexander-akhmetov/python-shortcuts</a>
Scriptable by Simon B. Støvring <a href="https://itunes.apple.com/us/app/scriptable/id1405459188?mt" rel="nofollow">https://itunes.apple.com/us/app/scriptable/id1405459188?mt</a>