The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
1. The lounge is for the CodeProject community to discuss things of interest to the community, and as a place for the whole community to participate. It is, first and foremost, a respectful meeting and discussion area for those wishing to discuss the life of a Software developer.
The #1 rule is: Be respectful of others, of the site, and of the community as a whole.
2. Technical discussions are welcome, but if you need specific programming question answered please use Quick Answers[^], or to discussion your programming problem in depth use the programming forums[^]. We encourage technical discussion, but this is a general discussion forum, not a programming Q&A forum. Posts will be moved or deleted if they fit better elsewhere.
4. No politics (including enviro-politics[^]), no sex, no religion. This is a community for software development. There are plenty of other sites that are far more appropriate for these discussions.
5. Nothing Not Safe For Work, nothing you would not want your wife/husband, your girlfriend/boyfriend, your mother or your kid sister seeing on your screen.
6. Any personal attacks, any spam, any advertising, any trolling, or any abuse of the rules will result in your account being removed.
7. Not everyone's first language is English. Be understanding.
Please respect the community and respect each other. We are of many cultures so remember that. Don't assume others understand you are joking, don't belittle anyone for taking offense or being thin skinned.
We are a community for software developers. Leave the egos at the door.
My Google-fu is failing me. The problem (I think) is easy to describe, but not to Google, apparently.
Does anyone know of a really simple tool that can simulate a key being held down...and--this is important in this context--can easily be toggled on and off?
My reason for asking: I have a game that often requires me to walk in what is essentially a straight line in some direction for quite some distance, and I have to press and hold down the 'walk' button ("W" in this case; the game's using the standard "WASD" arrangement) for minutes at a time. This often gets tedious, and so every once in a while I take a small but heavy object and try to balance it carefully on the key that needs to be held down...then while my character is moving on his own, I can do something else on another computer I have sitting next to me for a moment or two.
The problem is the "carefully balancing the object on the key" part. So I'm looking for a software solution. Ideally a one-key toggle, as in, "when I press this key (or key combination), simulate holding down this other button"...then press it again to "release" the button.
Of course I don't want something that needs me to alt-tab out of the game and back.
This is totally a first-world problem...but a solution would help remove one of the more tedious elements of this game. After all, I play to take some drudgery out of my life, not add to it...
I was thinking you could maybe run a program that registers a system-wide hotkey (assuming Windows here, since you didn't mention).
Then, when you hit the Ctrl-Alt-Shift-W or whatever the program would do keypresses (SendKey Windows KeyPress for 'w') foryou.
However, if the game is full-screen I don't think it'll respect the system-wide hotkey. I'm not sure.
If it doesn't then you would have to do this with hardware. Hardware Solution
This can be done very easily with a Arduino Leonardo (aka Pro Micro) because you plug one of those into a system running any OS (Linux, Win, Mac) and it will be recognized as a keyboard (it has built-in USB HID and is recognized as a keyboard.
You can get one for $7 USD (Amazon.com: FTCBlock Pro Micro ATmega32U4 5V/16MHz Module Boardc[^])
Then, it is a very simple matter of wiring up two buttons and a little code on the Arduino so when you hit one button, it continually types 'w' and then when you hit the other it stops.
If you have to go the hardware route, and you really want to try it I am happy to give a lending hand.
However, I understand that this is more extensive.