Author Topic: Remapping keys and/or buttons (making one key or button "follow" another)  (Read 2165 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
Physical input methods can be "remapped" so that pressing a given key or button causes another key or button to be pressed, and releasing that key or button causes the other key or button to be released.
Essentially one key or button will "follow" the other.

Click the link to the post relevant to your situation:

"Remap" a keyboard key to another keyboard key

"Remap" a keyboard key to a mouse button


"Remap" a joystick button to a keyboard key

"Remap" a joystick button to a mouse button


"Remap" a mouse button to a keyboard key

"Remap" a mouse button to another mouse button



As you may notice, joystick buttons can be "remapped" to other input methods, I.E. a joystick button can press and release a keyboard key or mouse button, however the Windows joystick APIs (DirectInput and XInput) do not support pressing joystick buttons (this is not VoiceAttack-specific), so other input methods cannot be used to press joystick buttons on existing devices.
I.E. joystick buttons on existing devices cannot be pressed using commands (or other methods; again, this is not VoiceAttack-specific, it's a Windows API limitation)

There is a third-party application, vJoy, which circumvents part of this limitation by using a custom device driver that presents itself as a joystick device to Windows, as a physical joystick would, but is designed to allow input through software.
This does mean that the device(s) created by this driver are wholly separate from existing devices. They are also DirectInput devices (as a classic joystick would be), not XInput devices like an XBox controller (which is what most modern games will support).
VoiceAttack can control vJoy devices using this plugin. The principle would be the same as other methods: one command triggered by a press, which presses a button on a vJoy device, and another command triggered by a release which releases a button on a vJoy device.
You'll want to read the instructions with the plugin thoroughly, and be aware of the limitations (I.E. it being a separate DirectInput device).

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
"Remap" a keyboard key to another keyboard key


1. Click the icon on VoiceAttack's main window

2. Click "New Command"

3. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap A to B Press"

4. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

5. Click "When I press keys"

6. Press the key you want to "remap", E.G. A

7. Make sure the "Do not allow key to be passed through" option is enabled; this will prevent the majority of applications from responding to this key (if you don't want that, don't enable this option)

8. Make sure the "Shortcut is invoked only when all keys are released" option is not enabled

9. Click "OK"

10. Click "Key Press"

11. Press the key you want to be pressed when the "remapped" key is pressed, E.G. B

12. Select the "Press Key(s)" option by clicking the circle to the left of it (not the "Press And Release Key(s)" option)

13. Click "OK"

14. Click "OK" to add the command to the current profile

15. Click "New Command"

16. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap A to B Release"

17. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

18. Click "When I press keys"

19. Press the key you want to "remap", E.G. A

20. Make sure the "Do not allow key to be passed through" option is enabled; this will prevent the majority of applications from responding to this key (if you don't want that, don't enable this option)

21. Make sure the "Shortcut is invoked only when all keys are released" option is enabled

22. Click "OK"

23. Click "Key Press"

24. Press the key you want to be released when the "remapped" key is released, E.G. B

25. Select the "Release Key(s)" option by clicking the circle to the left of it (not the "Press And Release Key(s)" option)

26. Click "OK"

27. Click "OK" to add the command to the current profile

28. Click "Done" to apply the changes to the current profile

29. Test the commands by pressing the "remapped" key. Note that virtual keypresses do not cause character repeats, E.G. if you were to test in notepad you'd only see one character for each press, no matter how long you hold down the key.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
"Remap" a keyboard key to a mouse button


1. Click the icon on VoiceAttack's main window

2. Click "New Command"

3. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap A to Left Mouse Button Press"

4. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

5. Click "When I press keys"

6. Press the key you want to "remap", E.G. A

7. Make sure the "Do not allow key to be passed through" option is enabled; this will prevent the majority of applications from responding to this key (if you don't want that, don't enable this option)

8. Make sure the "Shortcut is invoked only when all keys are released" option is not enabled

9. Click "OK"

10. Click "Mouse >"

11. Click "Click"

12. In the leftmost dropdown under "Mouse Click", choose "Press Down"

13. In the rightmost dropdown under "Mouse Click", choose the button you want to be pressed when the "remapped" key is pressed, E.G. "Left Button"

14. Click "OK"

15. Click "OK" to add the command to the current profile

16. Click "New Command"

17. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap A to Left Mouse Button Release"

18. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

19. Click "When I press keys"

20. Press the key you want to "remap", E.G. A

21. Make sure the "Do not allow key to be passed through" option is enabled; this will prevent the majority of applications from responding to this key (if you don't want that, don't enable this option)

22. Make sure the "Shortcut is invoked only when all keys are released" option is enabled

23. Click "OK"

24. Click "Mouse >"

25. Click "Click"

26. In the leftmost dropdown under "Mouse Click", choose "Release"

27. In the rightmost dropdown under "Mouse Click", choose the button you want to be released when the "remapped" key is released, E.G. "Left Button"

28. Click "OK"

29. Click "OK" to add the command to the current profile

30. Click "Done" to apply the changes to the current profile

31. Test the commands by pressing the "remapped" key.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
"Remap" a joystick button to a keyboard key

Note that joystick buttons cannot be prevented from passing through, I.E. applications using the joystick device will receive the button press and release, and potentially respond to that.
This is a Windows joystick API limitation not specific to VoiceAttack.


1. Click the icon on VoiceAttack's main window

2. Click "New Command"

3. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Joystick 1 Button 1 to B Press"

4. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

5. Click "When I press button"

6. Press the joystick button you want to "remap", E.G. Joystick 1 Button 1

7. Make sure the "Shortcut is invoked only when all buttons are released" option is not enabled

8. Click "OK"

9. Click "Key Press"

10. Press the key you want to be pressed when the "remapped" button is pressed, E.G. B

11. Select the "Press Key(s)" option by clicking the circle to the left of it (not the "Press And Release Key(s)" option)

12. Click "OK"

13. Click "OK" to add the command to the current profile

14. Click "New Command"

15. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Joystick 1 Button 1 to B Release"

16. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

17. Click "When I press button"

18. Press the joystick button you want to "remap", E.G. Joystick 1 Button 1

19. Make sure the "Shortcut is invoked only when all buttons are released" option is enabled

20. Click "OK"

21. Click "Key Press"

22. Press the key you want to be released when the "remapped" button is released, E.G. B

23. Select the "Release Key(s)" option by clicking the circle to the left of it (not the "Press And Release Key(s)" option)

24. Click "OK"

25. Click "OK" to add the command to the current profile

26. Click "Done" to apply the changes to the current profile

27. Test the commands by pressing the "remapped" button. Note that virtual keypresses do not cause character repeats, E.G. if you were to test in notepad you'd only see one character for each press, no matter how long you hold down the button.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
"Remap" a joystick button to a mouse button

Note that joystick buttons cannot be prevented from passing through, I.E. applications using the joystick device will receive the button press and release, and potentially respond to that.
This is a Windows joystick API limitation not specific to VoiceAttack.


1. Click the icon on VoiceAttack's main window

2. Click "New Command"

3. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Joystick 1 Button 1 to Left Mouse Button Press"

4. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

5. Click "When I press button"

6. Press the joystick button you want to "remap", E.G. Joystick 1 Button 1

7. Make sure the "Shortcut is invoked only when all buttons are released" option is not enabled

8. Click "OK"

9. Click "Mouse >"

10. Click "Click"

11. In the leftmost dropdown under "Mouse Click", choose "Press Down"

12. In the rightmost dropdown under "Mouse Click", choose the button you want to be pressed when the "remapped" button is pressed, E.G. "Left Button"

13. Click "OK"

14. Click "OK" to add the command to the current profile

15. Click "New Command"

16. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Joystick 1 Button 1 to Left Mouse Button Release"

17. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

18. Click "When I press button"

19. Press the joystick button you want to "remap", E.G. Joystick 1 Button 1

20. Make sure the "Shortcut is invoked only when all buttons are released" option is enabled

21. Click "OK"

22. Click "Mouse >"

23. Click "Click"

24. In the leftmost dropdown under "Mouse Click", choose "Release"

25. In the rightmost dropdown under "Mouse Click", choose the button you want to be released when the "remapped" button is released, E.G. "Left Button"

26. Click "OK"

27. Click "OK" to add the command to the current profile

28. Click "Done" to apply the changes to the current profile

29. Test the commands by pressing the "remapped" button.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
"Remap" a mouse button to a keyboard key

Note that mouse buttons cannot be prevented from passing through to other applications in this situation, due to a Windows API limitation (in more detail for those interested: if a press is intercepted, there will be no release event)
I.E. applications will receive both the mouse button press/release and the keyboard key press/release.


1. Click the icon on VoiceAttack's main window

2. Click "New Command"

3. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Right Mouse Button to B Press"

4. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

5. Click "When I press mouse"

6. Choose the mouse button you want to "remap" by clicking the icon, E.G. "Right"

7. Make sure the "Shortcut is invoked only when all buttons are released" option is not enabled

8. Make sure the "Do not allow button event to be passed through" option is not enabled; this would prevent these commands from working correctly

9. Click "OK"

10. Click "Key Press"

11. Press the key you want to be pressed when the "remapped" button is pressed, E.G. B

12. Select the "Press Key(s)" option by clicking the circle to the left of it (not the "Press And Release Key(s)" option)

13. Click "OK"

14. Click "OK" to add the command to the current profile

15. Click "New Command"

16. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Right Mouse Button to B Release"

17. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

18. Click "When I press mouse"

19. Choose the mouse button you want to "remap" by clicking the icon, E.G. "Right"

20. Make sure the "Shortcut is invoked only when all buttons are released" option is enabled

21. Make sure the "Do not allow button event to be passed through" option is not enabled; this would prevent these commands from working correctly

22. Click "OK"

23. Click "Key Press"

24. Press the key you want to be released when the "remapped" button is released, E.G. B

25. Select the "Release Key(s)" option by clicking the circle to the left of it (not the "Press And Release Key(s)" option)

26. Click "OK"

27. Click "OK" to add the command to the current profile

28. Click "Done" to apply the changes to the current profile

29. Test the commands by pressing the "remapped" button. Note that virtual keypresses do not cause character repeats, E.G. if you were to test in notepad you'd only see one character for each press, no matter how long you hold down the button.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4786
  • RTFM
"Remap" a mouse button to another mouse button

Note that mouse buttons cannot be prevented from passing through to other applications in this situation, due to a Windows API limitation (in more detail for those interested: if a press is intercepted, there will be no release event)
I.E. applications will receive both button presses/releases.


1. Click the icon on VoiceAttack's main window

2. Click "New Command"

3. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Right Mouse Button to B Press"

4. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

5. Click "When I press mouse"

6. Choose the mouse button you want to "remap" by clicking the icon, E.G. "Right"

7. Make sure the "Shortcut is invoked only when all buttons are released" option is not enabled

8. Make sure the "Do not allow button event to be passed through" option is not enabled; this would prevent these commands from working correctly

9. Click "OK"

10. Click "Mouse >"

11. Click "Click"

12. In the leftmost dropdown under "Mouse Click", choose "Press Down"

13. In the rightmost dropdown under "Mouse Click", choose the button you want to be pressed when the "remapped" key is pressed, E.G. "Left Button"

14. Click "OK"

15. Click "OK" to add the command to the current profile

16. Click "New Command"

17. In the "When I say" field, replace the default contents with a sensible name, E.G. "Remap Right Mouse Button to B Release"

18. Uncheck the box to the left of "When I say", as this command should not be used with speech recognition

19. Click "When I press mouse"

20. Choose the mouse button you want to "remap" by clicking the icon, E.G. "Right"

21. Make sure the "Shortcut is invoked only when all buttons are released" option is enabled

22. Make sure the "Do not allow button event to be passed through" option is not enabled; this would prevent these commands from working correctly

23. Click "OK"

24. Click "Mouse >"

25. Click "Click"

26. In the leftmost dropdown under "Mouse Click", choose "Release"

27. In the rightmost dropdown under "Mouse Click", choose the button you want to be released when the "remapped" key is released, E.G. "Left Button"

28. Click "OK"

29. Click "OK" to add the command to the current profile

30. Click "Done" to apply the changes to the current profile

31. Test the commands by pressing the "remapped" button.