Author Topic: Press and Hold Key as if using Keyboard  (Read 2505 times)

scottb613

  • Newbie
  • *
  • Posts: 32
Press and Hold Key as if using Keyboard
« on: November 09, 2022, 06:44:57 PM »
Hi Folks,

I've used and enjoyed VA for many years on a wide array of applications - best $10.00 I've ever spent.

Question - how do I press and hold a key press in VA as if I were doing it on the keyboard - when using a game controller? I've tried this with two different Train Sim games and it's as if the keystrokes aren't being sent as fast as a keyboard would. For example - when holding the keyboard spacebar I get a nice steady horn blow for as long as the spacebar is depressed - when using VA and the Game Controller - it's a blow - pause for a second blow. The issue is that the keypress needs to maintain the horn blow for as long as the button is held down - it's up to the user how long it is held every time.

It's not the Sim or Game Controller - because I use another keyboard emulator "Joy2Key" and it works absolutely fine with the same setup. I just want to leverage the more powerful functionality in VA to better run my sim.

I tried increasing the joystick poling to 50 - no change. I don't know what a standard keyboard sends.

Thanks.

Regards,
Scott

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2828
Re: Press and Hold Key as if using Keyboard
« Reply #1 on: November 09, 2022, 09:56:08 PM »
Hi, Scott

You'll want to make a command that looks something like this:

Write [ Blue] 'Key Down' to log
Press down Space key
Start Loop While :  Joystick 1 Button 1 Is Pressed
End Loop
Release Space key
Write [ Blue] 'Key Up' to log

You'll need to have the command triggered on a joystick button press.  Note that I'm using joystick 1 button 1 in the example - yours may be different.  Also, the keyboard actions are down and up only (and not press and release in one action).  Also also, the 'Write to log' actions are optional - just there to show the command is working.

This can also be achieved with two commands - one triggered by a joystick button down (with a spacebar key press down action only) and another triggered by joystick button release (with a spacebar release key action only).

Hope that helps!

scottb613

  • Newbie
  • *
  • Posts: 32
Re: Press and Hold Key as if using Keyboard
« Reply #2 on: November 10, 2022, 06:16:27 AM »
Hi Gary,

Did I mention the world class support around here?

Thanks - let me give that a shot.
 :)

Regards,
Scott

scottb613

  • Newbie
  • *
  • Posts: 32
Re: Press and Hold Key as if using Keyboard
« Reply #3 on: November 10, 2022, 06:32:09 AM »
Hi Gary,

So simple a caveman could do it. Works perfectly.

Hope all is well - the few times I've needed help - you've been a pleasure to work with.

FYI: I use VA for Flight Sims - Train Sims - ArmA - 3D Modeling Software - Graphics Programs. What a godsend. The mouse macros are EXCEPTIONALLY helpful when 3D modeling. When working with fairly large 32"monitors it allows you to keep your eyes focused on your work instead of breaking concentration to seek the next function you need via toolbars or icons on side panels. When you spend hundreds of hours making a model it makes a big difference. Much of the time I'm using it without the voice aspect as well. I've been an IT guy in NYC for the past 30 years and this is one of the most intuitive and easy to use programs I've ever seen. Yeah - I'm a fan.

Be well - sir.

Regards,
Scott

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2828
Re: Press and Hold Key as if using Keyboard
« Reply #4 on: November 11, 2022, 12:57:49 PM »
VA's dedicated community is what keeps this project alive and exciting :)

Glad to hear you're getting a lot out of VA!

nka

  • Newbie
  • *
  • Posts: 5
Re: Press and Hold Key as if using Keyboard
« Reply #5 on: February 26, 2024, 09:33:35 PM »
Sorry to hijack this topic, but can we do the same in the GUI? I'm using the latest version as today.

Thanks!   :D

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4767
  • RTFM
Re: Press and Hold Key as if using Keyboard
« Reply #6 on: February 27, 2024, 12:42:25 AM »
The command structures Gary mentioned above would be created using the GUI.

If you're referring to an option that doesn't use command(s), then no.

nka

  • Newbie
  • *
  • Posts: 5
Re: Press and Hold Key as if using Keyboard
« Reply #7 on: February 27, 2024, 05:23:11 AM »
sorry yes, this is what I mean. I will create scripts then. Thanks!