AndroidApps

An important note about chaining together commands in AutoVoice

Screenshot_2013-05-16-12-44-16The ability to chain together commands in AutoVoice is one of the advantages it has over the stock Get Voice action, but there’s also a problem with this system that is caused by Tasker itself, can be hard to understand, and can cause a lot of issues. Luckily, it’s also easy to fix!

To chain together commands in AutoVoice you use command IDs, as explained in the AutoVoice guide. This normally works well, but there’s an inherent problem with this system, and it’s caused by how Tasker works. When you use an AutoVoice Recognize action and speak a command, each AutoVoice Recognized-based profile will be checked for matches, one by one, rather than all at once. This means that if you have two profiles that match, both will activate, but one will do so before the other.

The problem occurs when a Command ID-dependent context’s command filter also matches the command used to trigger the profile whose Command ID the profile is dependent on. I know that sentence is hard to swallow, so here’s an example:

Profile 1:
Context
Command filter: watch a movie on XBMC
Command ID: xbmc
Task
Action 1: (whatever action is used to open XBMC)
Action 2: Say: Which movie do you want to watch?
Action 3: AutoVoice Recognize

 
Profile 2:
Context
Command filter:
Last Command ID: xbmc
Task
Action 1: (whatever plugin is used to play a specific file)

The logic behind this setup is simple. First you have a command that opens up XBMC, then it asks you what you want to watch, and then you respond. Since you use the command ID system, you can then leave the command filter blank on the second profile, and just make it dependent on the first profile having run before it instead. Makes total sense, right? Yes, but this has a big chance of not working.

The reason is that Tasker might trigger profile 1 before it checks profile 2. If it does that, the command ID will have been set to “xbmc” by the time it checks profile 2. Because profile 2 doesn’t have a command filter, it will match any command, and since the command ID dependency is now filled, it will trigger almost at the exact same time as the first one.

How to fix it

Obviously this can lead to a ton of issues, which is why it’s a good thing that it’s easy to fix. All you have to do is to not specify a command ID in the first profile, but instead add a short Wait action followed by a Set Last Cmd Id action at the beginning of the task attached to that profile. This means that the command ID will still be set, but it will add just enough of a delay to allow Tasker to finish checking the other contexts before the command ID is set. Exactly how long the Wait needs to be will likely vary, but we’re talking a couple of hundred milliseconds here, which doesn’t really slow down your task.

tasker banner - for some reason we don't have an alt tag here

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

6 thoughts on “An important note about chaining together commands in AutoVoice

  • Thanks for the information. I mostly was interested in AutoVoice because of the Bluetooth issue with GetVoice. So now I have a non-Bluetooth command system based on GetVoice and a Bluetooth command system based on AutoVoice. lol The more I read these articles the more I think I should just use AutoVoice for both but I’m still on the fence.

    Reply
  • Is there any way for AutoVoice to recognize the name of any app or contact name? I’d like to create profiles for “Open [app name]” or “Text [contact]”.

    So far I’ve only been able to do this by creating a profile for each individual app or contact, but I’ve got too many apps and contacts to do them all individually.

    Reply
  • Avatar of Sunil Kolambkar

    Hi Andreas

    Can you help me on following.

    I have 3 Autovoice Profiles. Command filter of each one and its task is as follows –

    1. Make call|call|phone (regex). Task – Call %avcommnofilter (This should open phone dialer)

    2. home|residence (regex). Task – Call my home

    3. home screen (regex) – Task – Go Home Page 3

    Now when I say “Call Home” … Tasker open call screen first then dial my home. – Partially Correct but I can see 2 tasks happening.

    When I say “Go to Home Screen” … Tasker still dial my home

    When I say “Home” or “Residence” .. Tasker “Directly” Dial my home..

    I really confuse on Command ID and How to chain these profiles.

    Please guide me on correct chaining and How I can chain / correct this issue.

    Thanks in Advance.

    Sunil
    Mumbai, India.

    Reply
    • Avatar of Andreas Ødegård

      Command IDs won’t help you here, since they are three separate profiles and aren’t chained together. You simply need to pick better command filters that don’t overlap, or use a system of Ifs to limit some of them

      Reply
  • it works, but makes no sense. your reason seems flawed to me:

    “The reason is that Tasker might trigger profile 1 before it checks profile 2. If it does that, the command ID will have been set to “xbmc” by the time it checks profile 2”

    if it checks and triggers profile 1 first, then the command id is being set either way (on the profile, at the beginning of the task or after 150ms) and then it checks and triggers profile 2. so it shouldn’t make a difference

    Reply
  • Hi Sir,

    Could you kindly help me on this one.

    I’ve created a profile that is triggered once a message is received.

    In the event that a new message is received, Tasker will tell me who sent it and then ask me if i’d want it read.
    Then, using autovoice, it’ll wait for me to say “yes” or “no”. Once, i say yes, it will read the message, and then ask me if i’d want to reply, which is also answerable by “yes” or “no”. However, when I do that, it becomes troublesome since both tasks are triggered.
    Please note that i’ve already read and used “Command ID”.

    I know it would be easier to just change the required response so that it will not be a problem. However, I was just wondering if Command ID works only when there are similar responses but for different threads, or even with similar commands in the same thread?
    Thank you so much.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *