Author Topic: New Help With 2 Things Please  (Read 1168 times)

SteveXM

  • Newbie
  • *
  • Posts: 17
New Help With 2 Things Please
« on: January 01, 2019, 11:07:22 AM »
#1: When using my wireless headphones while walking around my house I often lose connection. Is there a way that i can have my Headphones automatically switch to the "Windows Speech Recording Device"? It defaults to something else. Once I lose connection with my PC [Xbox Wireless Adapter], I have to go all the way to my stream room to switch the device back over to my headphones.

#2: I need to make a this easier to update in multiple commands.
       EX- Use [health pack;potion;other things]
             Store [health pack;potion;other things]

Is there a way that i do this?
          Use [List]

This way i can just update the list and it will update all the other commands, so I don't have to do them one by one.

Thanks again for all the help

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: New Help With 2 Things Please
« Reply #1 on: January 01, 2019, 02:54:15 PM »
#1: When using my wireless headphones while walking around my house I often lose connection. Is there a way that i can have my Headphones automatically switch to the "Windows Speech Recording Device"? It defaults to something else. Once I lose connection with my PC [Xbox Wireless Adapter], I have to go all the way to my stream room to switch the device back over to my headphones.
You can monitor the change and try to switch back when it happens.

Ideally you'd want to subscribe to the relevant event, but a simpler approach is to poll using VoiceAttack's built-in features instead:
Code: [Select]
Start Loop While : [1] Equals [1]
    Begin Text Compare : [{STATE_DEFAULTRECORDING}] Does Not Equal 'Xbox Wireless Adapter'
        Change playback device to: 'Xbox Wireless Adapter', Change recording device to: 'Xbox Wireless Adapter'
    End Condition
    Pause 10 seconds
End Loop
The device names would be the ones actually present on your system, of course.


#2: I need to make a this easier to update in multiple commands.
       EX- Use [health pack;potion;other things]
             Store [health pack;potion;other things]

Is there a way that i do this?
          Use [List]

This way i can just update the list and it will update all the other commands, so I don't have to do them one by one.

Thanks again for all the help
There are a few ways to make that easier to manage:

You could use a variable to do this in the manner you're describing(E.G. "Use [{TXT:list}]"), but then that has to be set when the profile is first loaded, and the profile reset to rebuilt the phrase list.

You can use prefix/suffix, with one side as the functional part and the other used to set parameters(you can use the "Jump to a Place in this Command" action and an appropriately placed marker to jump from a suffix back into a prefix, if it makes more sense to have the prefix be the functional part).

You can use dynamic command sections to combine multiple commands into one, using conditions to execute the appropriate actions for a given phrase.

Either prefix/suffix or dynamic command sections could also be used to execute other commands by proxy, which is basically the same setup as combining commands into one, but you could keep the different functions in separate commands(that won't be executed by speech themselves, but triggered by the single spoken command) to keep a better overview.

SteveXM

  • Newbie
  • *
  • Posts: 17
Re: New Help With 2 Things Please
« Reply #2 on: January 03, 2019, 03:37:49 PM »
So I think using the list variable method will be the easiest for me.

I tried a couple of things and couldn't get it to work.
Here is what I tried so far.

Command #1
{System Start Up} (Launch when switching to profile)
Set Text {list} to [Item 1;Item 2;Item 3]

Command #2  (If this works properly, I should be able to say "Use Item 1")
Use [{TXT:list}]
set item to {CMDSEGMENT:1}
if item=Item 1
press 1
if item=Item 2
press 2

I must have some syntax wrong somewhere.Thanks again Pfeil, you have helped me a lot already. This should be my last VA question for awhile ;)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: New Help With 2 Things Please
« Reply #3 on: January 03, 2019, 04:36:13 PM »
You need to reset the profile after setting the variable:
Code: [Select]
Begin Boolean Compare : [>>profileSetup] Does Not Equal True
  Set Text [list] to '[Item 1;Item 2;Item 3]'
  Set Boolean [>>profileSetup] to True
  Reset the active profile
End Condition
Because the variable has no value when the profile is loaded, the command phrase will not be correct until the profile is loaded a second time. You could do this manuallly by switching to another profile and back, or use the "Reset the Active Profile" option to do it automatically.
As the command is set to run on startup you also need the condition, to prevent an infinite loop.

Unfortunately the "Reset the Active Profile" action cannot be added using the normal menu(it'll add a blank keypress instead), so you'll have to copy it from another command(E.G. the one you imported from this topic).


As an aside, if you right-click the action list you can use the "Copy All as Text" option so you can paste the contents into a forum post, preferably into a code block(click the # button above the post's textbox to add those tags).