Author Topic: Command to listen for command while I look at list for a few seconds.  (Read 4084 times)

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Hello, I'm new here, is there any chance that I can set up a command that is able to listen to me for a few seconds while I look at a list of options? I want to say a number like: 1, for example, but I don't want to set up the command for 1 to do a task since I may say 1 multiple times while playing or something. For example I would say: Show menu, the command listen to me for at the most 5 seconds and if I don't say anything it in 5 seconds, it stops. Another example would be: show menu, I say number 4 after maybe 3 seconds of making my mind on the option, and then it performs the task. I want to set up commands for numbers: 1,2,...,8, for them to perform actions but I don't want them to perform their action while I'm just talking, how could I set them up for them to each have an action and only work when I say: show menu, or something like that. THANKS!!! :D :D :D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #1 on: April 11, 2023, 04:02:29 AM »
That is pretty much exactly what the "Wait For Spoken Response" action is intended for.


Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer, which contains information on VoiceAttack's features.

These topics may also be of use, in addition to the official documentation:
Control flow (If, Else, ElseIf, Loop, Jump) basics
Variables and tokens summed up

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #2 on: April 11, 2023, 11:45:47 AM »
That is pretty much exactly what the "Wait For Spoken Response" action is intended for.


Press F1 while VoiceAttack has focus to open VoiceAttackHelp.pdf in your default PDF viewer, which contains information on VoiceAttack's features.

These topics may also be of use, in addition to the official documentation:
Control flow (If, Else, ElseIf, Loop, Jump) basics
Variables and tokens summed up


Got it thanks! Now, how could I set up commands for numbers: 1,2,...,8, for them to perform actions but I don't want them to perform their action while I'm just talking, i.e. I want to say a number and for each number to perform a different command, but I don't want to set up their commands because I might say numbers while using voice attack.

I already set up the: get user input, very helpful. Thanks!!!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #3 on: April 11, 2023, 11:53:14 AM »
You can use the output of the action, and a set of conditions, E.G.
Code: [Select]
Wait for spoken response: '[1..8]'
Begin Text Compare : [~response] Equals '1'
    Press A key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '2'
    Press B key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '3'
    Press C key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '4'
    Press D key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '5'
    Press E key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '6'
    Press F key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '7'
    Press G key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '8'
    Press H key and hold for 0,05 seconds and release
End Condition
(in this example the "Text Variable" field of the "Wait For Spoken Response" action would have been set to "~response")

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #4 on: April 11, 2023, 11:58:10 AM »
You can use the output of the action, and a set of conditions, E.G.
Code: [Select]
Wait for spoken response: '[1..8]'
Begin Text Compare : [~response] Equals '1'
    Press A key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '2'
    Press B key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '3'
    Press C key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '4'
    Press D key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '5'
    Press E key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '6'
    Press F key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '7'
    Press G key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '8'
    Press H key and hold for 0,05 seconds and release
End Condition
(in this example the "Text Variable" field of the "Wait For Spoken Response" action would have been set to "~response")


THANKS!!!!

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #5 on: April 11, 2023, 12:24:12 PM »
You can use the output of the action, and a set of conditions, E.G.
Code: [Select]
Wait for spoken response: '[1..8]'
Begin Text Compare : [~response] Equals '1'
    Press A key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '2'
    Press B key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '3'
    Press C key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '4'
    Press D key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '5'
    Press E key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '6'
    Press F key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '7'
    Press G key and hold for 0,05 seconds and release
Else If Text Compare : [~response] Equals '8'
    Press H key and hold for 0,05 seconds and release
End Condition
(in this example the "Text Variable" field of the "Wait For Spoken Response" action would have been set to "~response")


Alright, I set that up but It's not recognizing my response, is it because there is a specific name to link the "Wait for spoken response" to the "Text compare [Brackets]"? Thanks

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #6 on: April 11, 2023, 12:27:39 PM »
As mentioned, if you're copying the example verbatim, you'd want to set the "Text Variable" field of the "Wait For Spoken Response" action to
Code: [Select]
~response

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #7 on: April 11, 2023, 12:35:18 PM »
As mentioned, if you're copying the example verbatim, you'd want to set the "Text Variable" field of the "Wait For Spoken Response" action to
Code: [Select]
~response

Yeah, I did that, let me send you a screenshot

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #8 on: April 11, 2023, 12:37:51 PM »
What does your full command look like? Right-click the action list, choose "Copy All as Text" from the context menu, then paste here into a code block (click the # button)

A screenshot of the configuration of the "Wait For Spoken Response" action could also be useful

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #9 on: April 11, 2023, 12:40:02 PM »
What does your full command look like? Right-click the action list, choose "Copy All as Text" from the context menu, then paste here into a code block (click the # button)

A screenshot of the configuration of the "Wait For Spoken Response" action could also be useful

Code: [Select]
Press R key and hold for 0.1 seconds and release
Press R key and hold for 0.1 seconds and release
Press Left Ctrl+2 keys and hold for 0.1 seconds and release
Press Left Ctrl+1 keys and hold for 0.1 seconds and release
Press Left Ctrl+4 keys and hold for 0.1 seconds and release
Wait for spoken response: '[1..8]'
Begin Text Compare : [~response] Equals '1'
    Press Left Ctrl+1 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '2'
    Press Left Ctrl+2 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '3'
    Press Left Ctrl+3 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '4'
    Press Left Ctrl+4 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '5'
    Press Left Ctrl+5 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '6'
    Press Left Ctrl+6 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '7'
    Press Left Ctrl+7 keys and hold for 0.1 seconds and release
Else If Text Compare : [~response] Equals '8'
    Press Left Ctrl+8 keys and hold for 0.1 seconds and release
End Condition

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #10 on: April 11, 2023, 12:47:26 PM »
That looks correct. Do you have a screenshot of how the "Wait For Spoken Response" action is configured?

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #11 on: April 11, 2023, 12:50:17 PM »
That looks correct. Do you have a screenshot of how the "Wait For Spoken Response" action is configured?

Thank you so much for your help BTW

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #12 on: April 11, 2023, 12:53:50 PM »
As mentioned, if you're copying the example verbatim, you'd want to set the "Text Variable" field of the "Wait For Spoken Response" action to
Code: [Select]
~response

You currently have the "Text Variable" field of the "Wait For Spoken Response" action set to
Code: [Select]
[1..8]instead of
Code: [Select]
~response

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #13 on: April 11, 2023, 01:00:36 PM »
As mentioned, if you're copying the example verbatim, you'd want to set the "Text Variable" field of the "Wait For Spoken Response" action to
Code: [Select]
~response

You currently have the "Text Variable" field of the "Wait For Spoken Response" action set to
Code: [Select]
[1..8]instead of
Code: [Select]
~response

Okay, done that, still doesn't work for some reason
these are the settings for one of the what if blocks:

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Command to listen for command while I look at list for a few seconds.
« Reply #14 on: April 11, 2023, 01:06:25 PM »
How are you testing the command?


The "Wait For Spoken Response" action does not provide feedback (E.G. a "Recognized" entry in the log on VoiceAttack's main window) by itself.

You could add a "Write a Value to the Event Log" action, either to the bottom of the command, or directly after the "Wait For Spoken Response" action:
Code: [Select]
Write [Green] 'Response recognized: {TXT:~response}' to log


If you don't see the "Response recognized:" message in the log on the main window after you execute the command and speak a number, try increasing the "Timeout" value

GolddenWaffels

  • Newbie
  • *
  • Posts: 17
Re: Command to listen for command while I look at list for a few seconds.
« Reply #15 on: April 11, 2023, 01:09:53 PM »
How are you testing the command?


The "Wait For Spoken Response" action does not provide feedback (E.G. a "Recognized" entry in the log on VoiceAttack's main window) by itself.

You could add a "Write a Value to the Event Log" action, either to the bottom of the command, or directly after the "Wait For Spoken Response" action:
Code: [Select]
Write [Green] 'Response recognized: {TXT:~response}' to log


If you don't see the "Response recognized:" message in the log on the main window after you execute the command and speak a number, try increasing the "Timeout" value

Alright, it started to work now, I guess the option didn't save or something, I reloaded the app and it worked. Thank you so much for your help!!!