Save up to 50% in our Spring Sale!
Save up to 50% off any of our desktop apps in our Spring Sale, including DisplayFusion,
ClipboardFusion, FileSeek, iTunesFusion, LogFusion, TrayStatus, and VoiceBot!

Title

Message

Confirm

Want to earn a free VoiceBot Pro license? We're looking for VoiceBot translators!
<< DiscussionsReply

Continue pressing key until interrupted

FluffyBunnyFeet's profile on WallpaperFusion.com
From an earlier discussion, I copied text that Keith Lammers had provided for having Voicebot continuously presses (presses and hold), until another key is pressed, but that doesn't seem to be working.

Code



The code above simply presses "w" once, and stops.
This is for use in the game,. DayZ, for running long distances. I want to just 'aim' and then when needed press a key to stop the running. (I got it to work earlier (continuously press/hold W, but then couldn't get it to stop, no matter what, so I had to exit voicebot.

Any ideas?

Thanks,

Van

EDIT: I've also added in a number of other break keystrokes, none of which work:
====================================
// Send W continuously
BFS.Input.SendKeyDown("{VK_119}");
// loop forever
while (true)
{
if (BFS.Input.IsKeyDown("15")) { BFS.Speech.TextToSpeech("Virtual Key 15 detected down"); BFS.General.Sleep(1250); break; }
if (BFS.Input.IsKeyDown("14")) { BFS.Speech.TextToSpeech("Virtual Key 14 detected down"); BFS.General.Sleep(1250); break; }
if (BFS.Input.IsKeyDown("32")) { BFS.Speech.TextToSpeech("Virtual Key 32 detected down"); BFS.General.Sleep(1250); break;}
====================================

The script, in fact, stays running, no matter which key I press (and I've tried a lot), I have to stop it by cliking the icon in the systray.
Nov 1, 2018 (modified Nov 2, 2018)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
SendKeyDown is different than how physically holding a key on a keyboard works. When you physically hold a key, the key actually gets repeated (try it in Notepad). SendKeyDown just sets the key state to down once until it's released.

Next week I will do some testing to see if there's a way to script holding the W key in a way that a game would recognize it as a held key.
Nov 2, 2018  • #2
FluffyBunnyFeet's profile on WallpaperFusion.com
Thanks Keith,

unless you come up with a better solution, for now, I'm just going to have an action to "Press key: SHIFT+W", then the macro which waits for a cancelling keypress, then another action to "Release key: SHIFT+W".
it's a little kludgey, but It works.

Thanks,

Van
Nov 3, 2018 (modified Nov 3, 2018)  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, try the attached script out. It repeats the W key quickly, it's as close as I could get to how it behaves when you hold the key down (test it in notepad if to see what it does). Pressing left shift should stop it from running.
• Attachment: HoldWUntilShiftPressed.txt [542 bytes]
Nov 7, 2018 (modified Nov 7, 2018)  • #4
Was this helpful?  Login to Vote  Login to Vote
<< DiscussionsReply