Mac shortcuts app activation from TiddlyWiki

Hello,

As TiddlyWiki lover and Mac user I recently discovered that it’s possible to activate Apple Shortcuts app from a tiddler, with <a href="shortcuts://run-shortcut?name=myShortcut/> instruction.

The example below is to open a file based on the information of its location on the Mac

\define OpenPreview(mypath)
<div style="font-size:0.8em;text-align:center;margin:0em auto;">
<a href="shortcuts://run-shortcut?name=OpenFile&input=text&text=$mypath$" class="tc-btn-big-green" style="border-radius:4px;background-color:#696969;" target="_blank" rel="noopener noreferrer"> ''Launch shortcuts `openFile`''</a>
</div>
\end

<$transclude $variable=OpenPreview mypath={{!!myfield}}/>

This requires to have created an openFile shortcut before.
You can refer to this video for the OpenFile content : https://www.youtube.com/watch?v=I8PAWVWm9h8&list=PL1bsBsPtN-9TD7u5lE_5KVn6KZ2T-D-7-

Of course there are some other, and easier, ways to open an external file from TW, but Shortcuts app allows to launch more complex shell scripts, javascript, or Apple scripts to generate actions.

I don’t have a clear idea on what I will do whit it yet, and my coding skills are limited, but I thought it could be interesting to share it with you all.

6 Likes

Cool. Wish there was something like that on Windows. (Hoping someone proves me wrong)

This is really interesting! I tested and it works on IOS too.

As I understand it other browsers can be extended to do the same, for different platforms. For Example Microsoft Office, and O365 do this to intergrate with the local Windows desktop. There are most likely browser extensions that do this, they add additional handlers, mime types etc… into those known to the browser. And more likely some local computer settings.

  • They should always involve interactive user actions otherwise they become an attack vector. For example imagin if just by visiting a website they could trigger malware on your computer to encrypt your computer and demand a ransom?

this is really cool, thanks!

we can also call bettertouchtool named triggers, using (remember to substitute the “shortcut input” variable)

osascript -e 'tell application "BetterTouchTool" to trigger_named "Shortcut Input"'

in the shell script

1 Like