Matt
Matt
For variable:%this items:%FirstCommand()
If %this ~ %temp
Do whatever
End if
End for
But if you're just trying to see if %vtemp appears anywhere in the %FirstCommand array, it would still seem best to do
If %FirstCommand ~ *%vtemp*
Do whatever
End if
Matt
Not to add confusion to the mix but hopefully add some useful suggestions...
Here is a brief outline of how I would approach this..
This is how I understand what you are trying to do..
You want the user to be able to type in the data and have it end up in a comma separated list. Like this..
%Command1 = "living room on,bedroom on,my room on"
%Command2 = "garage on,basement on,attic on
For this part I would use the voice input as well. This will help eliminate matching problems as the engine that creates the arrays will be the same one that creates the search variable. So use the get voice, covert it to lower case, trim leading and trailing white spaces then present it back to the user for verification then append it to %Command1 adding a comma to the end of course. Make sure you start the %Command1 with a comma so it looks like this..
%Command1 = ",living room on,bedroom on,my room on"
This will make searches easier as well..
I like Bobs Idea about using the index number to reference the task to perform for the matching Command. However I believe you can do it much faster and easier without using a for loop.
Check the user guide in variables / arrays and look for..
%arr(#?b/c) A comma-separated list of the array indices (lowest to highest) with matching values,or 0 if none match (2,3 in the example)
So when you get your voice search criteria and convert it to lowercase, trim out the white spaces and set it to %tempvoice you would search the array like this
Set %indexmatch = %Command(#?,%tempvoice,) // Note the commas, this should address your issue with collision domain //
Now %indexmatch will contain one of the following
1. %indexmatch --- this means there were no matches and it did not get set
2. 2,3 --- this means it matched %Command2 AND %Command3
3. 4 --- this means the only match was in %Command4
After some "IF" statements to figure out what the match was and act accordingly, proceed as Bob recommended with the Perform task...
Hopefully this helps... Rich..
Oops..
*** EDIT ***
> Now %indexmatch will contain one of the following // you should check to see the actual value of %indexmatch to make sure the following is Correct //
>
> 1. 0 --- this means there were no matches and it did not get set
** one more edit.... :(
> Set %indexmatch = %Command(#?*,%tempvoice,*) // Note the commas, this should address your issue with collision domain //
I added the * before and after the commas.....