AutoVoice Preload variables with XML

Discussion in 'AutoApps' started by Yamtam, Mar 31, 2015.

  1. Yamtam

    Yamtam New Member

    Joined:
    Mar 14, 2015
    Messages:
    5
    Likes Received:
    1
    I'm a complete noob at this stuff, but I really love tasker, especially with all the options that AutoApps brings to the table. You'll have to forgive me, as I am going to ask this in noob speak, but it's the only way I know to convey what I am trying to do. What I would like to be able to do, is use an XML to set an Autovoice received word, to a specific variable, without having to go through and set each one. I think this could be handled by a two-dimensional array, but Tasker doesn't support them, and I'm doing good just to get a simple array populated.
    The purpose of this would be to control my Milight color changing bulbs via UDP. So...if I say, change bulb1 to red, it will send var1. Change bulb2 blue will send var2, and so on. I am pasting a snippet of my XML below.
    Thanks,
    Yamus

    <micolor>
    <value>x00</value>
    <phrase>purple</phrase>
    </micolor>
    <micolor>
    <value>x10</value>
    <phrase>blue</phrase>
    </micolor>
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    So what part are you having trouble with?
     
  3. Yamtam

    Yamtam New Member

    Joined:
    Mar 14, 2015
    Messages:
    5
    Likes Received:
    1
    Unfortunately, I had to factory reset my replacement device that I just received yesterday, so I am in the process of trying to apply about 5 OTA updates right now, and don't have my task in front of me. I'll try to explain better, with the little knowledge that I have. I am able to use "Variable split" to get the first value, and assign it to a variable, but I'm not sure what to do from there. The x values end up being every tenth element in the array, and I'm still left with all the data between the splits out there. I'm sure there is some way to loop through this to get just the data I need stored into an array, but I haven't quite figured it out.
    That really doesn't have anything to do with Autovoice, but more getting the data I want to use with Autovoice. Let's say I figure out how to get all the %values in one array, and all the %phrase in another, both with the same number of elements. How then could I make AutoVoice pass %value1 when %phrase1 is spoken, and pass %value5 when %phrase5 is spoken. %phrase only being a single word, that will be in my AutoVoice recognized Profile.
     
  4. TomTcom

    TomTcom Member

    Joined:
    Mar 18, 2015
    Messages:
    124
    Likes Received:
    5
    Variable set with if conditions would be my guess.
     
  5. TomTcom

    TomTcom Member

    Joined:
    Mar 18, 2015
    Messages:
    124
    Likes Received:
    5
    Sorry didn't read your original post. I can't comment with xml. While I understand the syntax I don't know it's usage with tasker or other setups.
     
  6. Yamtam

    Yamtam New Member

    Joined:
    Mar 14, 2015
    Messages:
    5
    Likes Received:
    1
    That actually does help some. The XML is just the way I happen to have the file laid out for an "AutoVoice" voice type app for Windows. I just want to figure out how to parse them for variables that can be called with Autorecognize words. I'll play around with it, and see if I can get it to be something like:

    If recognized = blue then code =a
    else if recognized = red, then code = b.

    That's about the extent of my coding skills. lol
     
  7. TomTcom

    TomTcom Member

    Joined:
    Mar 18, 2015
    Messages:
    124
    Likes Received:
    5
    Tasker is my level of coding too...lol.

    Well, if we forget about xml for the moment and just focus on Tasker, I would say your statement looks like you want to do something like this:

    Instead of "if recognized", how about Variable set like I said above, then in the variable set page add an If. Take the variable you want to use and use an operator of equals, matches, and so on.
    After that is done, add Tasker task next and do an If or Else on it.

    My thing is I don't use voice at all so I'm only saying from the variable with text perspective.

    How about posting your description of your task of what you have so far?
     
  8. Yamtam

    Yamtam New Member

    Joined:
    Mar 14, 2015
    Messages:
    5
    Likes Received:
    1
    Hey Tom,
    So I just worked on this thing for two hours, and couldn't get it to work, so I came crawling back to the forum, hoping someone would release the pressure off my brain. lol. I ended up doing exactly what you said above....uhh... I think. :confused:

    I created two if then else statements. One to populate the xNumber into a variable, and another to populate the color into a variable. It all looked so perfect until I ran it with using the AutoVoice recognized profile. The command uses regex and two "user created variables", which should be set based on the results of my two if statements. I'm sure the profile part is written correctly, as I followed "AutoVoice Custom Variables" tutorial on the main AutoVoice page, and it worked like a charm.

    What happens is, I say the command, Tasker goes through my first If Else and populates %var1. It then calls the next If Else using "Perform Task" at the end of the first one. Unfortunately, it doesn't populate my %var2. Looking in my logs, it shows that the second If is called, but immediately makes the AV Rec Profile inactive, so Tasker doesn't know what to set the %var2 to. After reading your post here, I tried setting the second variable manually, and running everything, and it worked great. I'm sure there is something simple I'm missing, but I'm just not catching it, and I think my brain is done for the night. If you have any more thoughts, please do let me know.
     
  9. Yamtam

    Yamtam New Member

    Joined:
    Mar 14, 2015
    Messages:
    5
    Likes Received:
    1
    Scratch that!!! I just got it working. Instead of having the first If call the second one, I just stacked them. Works like a charm :D. I'm super stoked, as this is the first decent Tasker project I have ever written. Thanks again for your replies, and I'm sure we'll talk again.
    Cheers,
    Yamtam
     
    TomTcom likes this.
  10. TomTcom

    TomTcom Member

    Joined:
    Mar 18, 2015
    Messages:
    124
    Likes Received:
    5
    Lol...no problem. I think many people including myself have the same problem. Just need and idea pr two and to talk it out.
     
  11. stress1ner

    stress1ner New Member

    Joined:
    May 31, 2015
    Messages:
    1
    Likes Received:
    0
    can you share the profile?
     

Share This Page