Author Topic: How to use Keyboard for Mouseclicks  (Read 1413 times)

Tiramisu

  • Newbie
  • *
  • Posts: 8
How to use Keyboard for Mouseclicks
« on: August 15, 2020, 08:36:13 AM »
I want to use my keyboard instead of the mouse-bottons for left/rigth/middle-cklick in order to avoid muscle fatigue. Since I could not find anything about this specific topic, I would like to know how to achieve this properly in VA.

My first attempts did not work very well, because I used loops that sometimes caused my PC to click rapidly without stopping. In addition, I had the problem that my keyboard commands collided with existing commands. In particular I want to use the arrow keys for my clicks, but when I try to block those keys for a specific window, then they will not be detected by VA either.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to use Keyboard for Mouseclicks
« Reply #1 on: August 15, 2020, 08:46:26 AM »
The "Block Keyboard Input" will indeed prevent input to VoiceAttack as well, so it can't currently be used as a dynamic substitute for the "Do not allow key to be passed through" option.

The "Do not allow key to be passed through" option applies to commands in a specific profile, so you could switch to another profile for your specific target application(s), in which you have assigned the arrow keys to commands that press the relevant mouse buttons.

Such a command could look like
Code: [Select]
Hold left mouse button down
Start Loop While :  Keyboard Key 'Down Arrow' Is Pressed
End Loop
Release left mouse button
Where the loop will wait for the keyboard key to be released before releasing the mouse button, thus allowing you to click and drag, for example.

Tiramisu

  • Newbie
  • *
  • Posts: 8
Re: How to use Keyboard for Mouseclicks
« Reply #2 on: August 16, 2020, 06:10:14 AM »
That might work well, because it is guaranteed that 'mouse up' happens after 'mouse down'.
In the meantime I have tried another solution using "When I press key" for both mouse up and down, while the mouse up command uses the "Shortcut is invoked only when all keys are released"-option in addition to make sure it only applies, when I release the arrow key. However, this solution has weird results, because mouse up is sometimes not applied in time so I end up pressing the mouse button down while no key is pressed.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: How to use Keyboard for Mouseclicks
« Reply #3 on: August 16, 2020, 06:55:05 AM »
A command set up to trigger when a key is released should always execute shortly after any command mapped to pressing the same key (as logically a release of a keyboard key will follow a press of a keyboard key).

Are there any other actions in your commands aside from the mouse click?


If a command is executing before another command that was triggered earlier, something is going wrong on your machine.


Do note that switching profiles while a key is down will cause any commands set up to trigger when that key is released, not to trigger until the key has been pressed again.