Author Topic: Pass CTRL modifier so that command recognizes CRTL-2 as opposed to 2...  (Read 512 times)

iliad

  • Newbie
  • *
  • Posts: 8
I have a VA command that when I press the number 2, a command will trigger. However, I do not want the same command to be triggered when I use a ctrl key modifier.

For example:
2 = Set Sound level to 100%
CTRL 2 = NOTHING happens. Simply want this to be passed to my application.

When I press CTRL 2 it still registers as if I am pressing 2.  How can I prevent the behavior?
I've tried creating an actual command CTRL 2 that ignores my input, but still, when pressing CTRL 2, it triggers 2.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
If you're not attempting to prevent the "2" key from being passed through, you could let the command execute regardless, but check whether modifiers are also pressed, and stop the command if so.

E.G.
Code: [Select]
Begin Device State Check :  Keyboard Key 'Ctrl' Is Pressed
End Condition - Exit when condition met
Set system audio volume to [100]

Other modifier checks (E.G. if you'd like to also ignore Shift-2 and Alt-2) can be added using the condition builder.


If you'd prefer to use two commands as you were attempting to do, you'd need to enable the "Shortcut is invoked only when all keys are released" option for both commands.

iliad

  • Newbie
  • *
  • Posts: 8
Thanks. Just to be clear, with Voice Attack, it will recognize the input as being 2, even when a CTRL modifier is being pressed?
In other words, 2=CTRL2 as far as it's concerned.

And if so that's fine, you mentioned the work around.
I haven't used it to pass code, so using your example, where would I actually make the call to the code.
I can see the advanced section to set values, conditionals, and so on. Or is that more beyond the scope and time to break out some videos/manuals?
:)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Yes. You're configuring VoiceAttack to execute a command whenever a given key is pressed. Other keys that may happen to be pressed at the same time, be they modifiers or otherwise, will not affect that in a normal configuration.


The "Code" block is just a forum markup feature. What's in it is an example of what the action list of your command would look like after having added the appropriate actions.

In this case, a "Begin a Conditional (If Statement) Block" action, "End a Conditional Block" action (which will be added automatically), and a "Set Audio Level" action (as you mentioned the command is intended to "Set Sound level to 100%"; this would be whatever your command currently contains).

All of these actions can be found in the context menu shown when clicking the "Other >" button on the "Edit a Command" window.

iliad

  • Newbie
  • *
  • Posts: 8
Thanks, much appreciated.