Author Topic: Use Voice commands to scroll up and down in a drop down menu.  (Read 2219 times)

olistreet

  • Newbie
  • *
  • Posts: 4
Use Voice commands to scroll up and down in a drop down menu.
« on: February 02, 2020, 09:02:48 AM »
Hi, I've just purchased the program, been using it in demo mode for few days, but i just thing is an awesome piece of software, and not just for games  :)

Well, for now I would love to use it for a very specific task, use voice commands like "up" and "down" to scroll up and down in a drop down menu.

So the issue here is that I know I have to play with temporal variables, assign values, but I'm just not being able to accomplish it, if I want my script to work I have to initialize a variable, and every time I say the "up"(mouse recorded macro) command it will only go one step above, and then the value gets reset to its first initialisation value, so I can go from Value 100 to 90, but when I say "down" again I can't go from 90 to 80, it just clicks again in 90.



Im  sure it's just a matter of declaring variables, but my programming skills are long gone! If anybody can help me with it, it would be greatly appreciated.

polynut

  • Newbie
  • *
  • Posts: 43
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #1 on: February 02, 2020, 10:29:23 AM »
Maybe it's not what you are looking for but for me to be able to scroll down in drop down menu is as easy as voice commands for arrow keys on the keyboard up, down, left, right.

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #2 on: February 02, 2020, 11:11:40 AM »
Rule #1 for doing stuff with VA and the mouse: try not to use the mouse ;)

Polynut has it pegged 100% -- use keyboard shortcuts wherever possible.  Just wanted to add that the Tab key is usually the way to navigate between elements such as 'ok' , 'cancel', and text input boxes -- Shift Tab goes backwards, try it out if you're not familiar.  So, tabs until the choice box is highlighted, then arrow keys for selection, then space or enter to choose / enact the choice.

If you ever change monitor size, or windows scaling, any of those preset mouse movement/click actions would likely break (moving to the wrong spot), so if at all possible, go for the most generic method using keyboard.

olistreet

  • Newbie
  • *
  • Posts: 4
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #3 on: February 03, 2020, 03:14:43 AM »
Hi Polynut and SemlerPDX,

Thanks for your answers, the program that I want to control is a music editor, and more specificly what I want to control is the tempo of the music, that goes from 40 bpm to 200 bpm.

The truth is that the drop down menu that I want to control it is only accesible via mouse (Which really doesn't worry me as I can use full screen) there's no tab interaction, which is weird, apart from that I need to remember the last position everytime I invoke the command, for that I need to declare variables.

If I just use down and up keyboards everytime I play a melodie it will default to the slowest tempo or to the fastest, I need to remember the last tempo used everytime I say the command "faster" or "slower".

I hope it's more clear now  :)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #4 on: February 03, 2020, 08:08:53 AM »
VoiceAttack does not require you to explicitly declare variables, you can simply provide a value and a name to the relevant action (E.G. "Set an Integer Value").

Which value are you trying to store exactly? How is your command set up (you can right-click the action list, choose "Copy All as Text", and paste into a code block here)?

olistreet

  • Newbie
  • *
  • Posts: 4
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #5 on: February 03, 2020, 12:15:43 PM »
Hi Pfeil,

Thanks for your support, below is the code, that I've tried to make work, so in short, when I say "slower" I should go from 100 bpm in the dropdown menu to 90 bpm, and if I say "slower" from 90 bpm to 80 bpm, and so on and so forth (When I get this right I have to do the same for "faster") but it's not working at all, in this example the command goes directly to 80 bpm.

 Press Left Ctrl+Left Shift+9 keys calls a macro recorder program that moves the mouse and keyboard to change values on the drop down menu.

Begin Integer Compare : [tempo] Equals 100
    Press Left Ctrl+Left Shift+9 keys and hold for 0,1 seconds and release
End Condition
Set integer [tempo] value to 90
Begin Integer Compare : [tempo] Equals 90
    Press Left Ctrl+Left Shift+8 keys and hold for 0,1 seconds and release
End Condition
Set integer [tempo] value to 80
Begin Integer Compare : [tempo] Equals 80
    Press Left Ctrl+Left Shift+7 keys and hold for 0,1 seconds and release
End Condition
Set integer [tempo] value to 70

In a very similar example to this one It worked once, so I might be close I think  ???

I have set some easy commands that if I say "eight" or "nine" will go straight to change the tempo to the desired one, but what I would like too is to have a couple of commands "slower" and "faster" to go from 50 bpm to 60 bpm etc, basically be able to go up and down the menu, but always the remembering the last bpm value (25%,50%,60%,70%,80%,90%,100%)

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #6 on: February 03, 2020, 12:58:27 PM »
It's going straight to 80 because you are setting your tempo to a value and then immediately checking that value. 

For instance:

Set integer [tempo] value to 90
Begin Integer Compare : [tempo] Equals 90
    Press Left Ctrl+Left Shift+8 keys and hold for 0,1 seconds and release
End Condition

You're setting tempo to 90 and then checking to see if it is 90.  You then go on to set the value to 80 and check if the value is 80.  You need to shift where you set the tempo to within the conditional statements:

Begin Integer Compare : [tempo] Equals 100
    Press Left Ctrl+Left Shift+9 keys and hold for 0,1 seconds and release
    Set integer [tempo] value to 90
End Condition
Begin Integer Compare : [tempo] Equals 90
    Press Left Ctrl+Left Shift+8 keys and hold for 0,1 seconds and release
    Set integer [tempo] value to 80
End Condition

etc.


Hope that helps some!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #7 on: February 03, 2020, 01:01:13 PM »
Is this "macro recorder program" built into the sound editing software? If not, VoiceAttack can also move the mouse and press keyboard keys, and has a recording function for both (so you could edit everything within one application).


You need to understand how the execution of your command will flow. This topic attempts to explain some of the concepts.

I'd consolidate all functionality into one command, so you only need the macros themselves (or the keyboard shortcuts for them) once:
When I say: tempo [1..5,100];faster;slower
Code: [Select]
Begin Text Compare : [{TXTNUM:"{CMD}"}] Does Not Equal ''
    Set integer [tempo] value to the converted value of {TXTNUM:"{CMD}"}
Else If Text Compare : [{CMD}] Contains 'faster'
    Begin Integer Compare : [tempo] Equals 100
        Write [Orange] 'Tempo is already as fast as possible' to log
    Else
        Set integer [tempo] to [tempo] plus 10
    End Condition - Exit when condition met
Else
    Begin Integer Compare : [tempo] Equals 50
        Write [Orange] 'Tempo is already as slow as possible' to log
    Else
        Set integer [tempo] to [tempo] minus 10
    End Condition - Exit when condition met
End Condition
Begin Integer Compare : [tempo] Equals 100
    Press Left Ctrl+Left Shift+0 keys and hold for 0,01 seconds and release
Else If Integer Compare : [tempo] Equals 90
    Press Left Ctrl+Left Shift+9 keys and hold for 0,01 seconds and release
Else If Integer Compare : [tempo] Equals 80
    Press Left Ctrl+Left Shift+8 keys and hold for 0,01 seconds and release
Else If Integer Compare : [tempo] Equals 70
    Press Left Ctrl+Left Shift+7 keys and hold for 0,01 seconds and release
Else If Integer Compare : [tempo] Equals 60
    Press Left Ctrl+Left Shift+6 keys and hold for 0,01 seconds and release
Else
    Press Left Ctrl+Left Shift+5 keys and hold for 0,01 seconds and release
End Condition

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #8 on: February 03, 2020, 01:30:18 PM »
Also, make sure to send Pfeil a beer (or many).

olistreet

  • Newbie
  • *
  • Posts: 4
Re: Use Voice commands to scroll up and down in a drop down menu.
« Reply #9 on: February 04, 2020, 01:54:47 AM »
Hi Gary and Pfeil and the rest of the team, thanks for helping me with this script! I'm at work now, but as soon as i get home I'll try to make it work, I'll let you know the results!