Quick Tasker tip: Use variables in AutoShortcut by editing the XML


AutoShortcut might be more subtle in its usefulness than some of its more famous AutoSiblings, but it’s nonetheless a great tool to have in your Tasker plug-in arsenal. Turns out that it has a hidden feature that has a lot of potential on its own, though it’s not so easy to get at.

Although not publicly advertised, AutoShortcut support variables. To use that feature, you first need to configure a shortcut action, export the task as an XML file, edit the XML to replace the parts of the shortcut code you want with a Tasker variable, and then re-import the task. The configuration screen won’t show anything different after you do this, but it will actually work, and you can then use the variables you set to control the shortcut.

How useful this is really depends on the situation. I found out about it because I needed it for an AutoVoice profile I was creating. The timer app I use (which is no longer being sold) allows you to start timers via shortcuts, and I found out that even though the configuration screen for adding shortcuts asks you to pick a saved timer, the actual shortcut contains both duration and name information, and as such isn’t dependent on the timer existing already to be used. This means that you just need to feed it a duration in seconds to create a new timer, regardless of whether it exists already. I created a quick task that converted any mentions of minutes and seconds into a single second variable, fed that as a variable to the part of the shortcut that requires a duration in seconds, and in no time at all I had a voice controlled timer that I can set to any combination of minutes and seconds I want:

I suspect that if one starts looking at the actual code for the shortcuts available on an Android device, one would find a lot of things that are compatible with a variable system. Of course the very nature of this requiring editing the XML of an exported task does make it more complicated than it needs to be, but on the other hand, you really need to investigate the shortcut’s code to even find anything to use variables for.

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Andreas Ødegård

Andreas Ødegård is more interested in aftermarket (and user created) software and hardware than chasing the latest gadgets. His day job as a teacher keeps him interested in education tech and takes up most of his time.

Avatar of Andreas Ødegård