I'm looking for a DOS TSR that will repeatedly press a keyboard key every few seconds. Preferably something that could be started and stopped by a predetermined hotkey combination.... something that could be run under DOSBox, and would support something like this:
Execute and load TSR (with command line parameters for start/stop hotkey combination, the repeated keypress key, and repeat duration).
Press the predetermined hotkey combination on your keyboard to start the repeated keypress (ENTER).
The ENTER key will then be pressed every 5 seconds.
Press the hotkey on your keyboard to stop the looped ENTER key presses.
You don't need a DOS TSR to map hotkeys to something running in DOSBox. If you have Windows, simply use AutoHotkey. I've used it to map keys and mouse buttons in several games running in DOSBox.
As an example, here's a script that I made to improve mouse controls in Dune II:
1#SingleInstance Force 2SetTitleMatchMode 2 3SendMode Event 4 5#If WinActive("DUNE2") 6{ 7; Middle mouse button: Build/Place/Attack 8mbutton::send {sleep 2}{b}{p}{a}{sleep 2} 9 10; Right mouse button: Harvest/Move (works for attacking in most cases) 11rbutton::send {sleep 2}{h}{m}{sleep 2}{lbutton} 12 13; Open Options menu with Esc key 14Esc::send {esc}{f2} 15 16; Navigate map & production screen with mouse wheel 17WheelUp::send {up} 18WheelDown::send {down} 19WheelLeft::send {left} 20WheelRight::send {right} 21}
The #If WinActive("DUNE2") line limits the script to sending key/button presses only to windows with a title of "DUNE2", so that's how you prevent it from working with anything but the DOS program. In addition, if you want to automate it, you can start AutoHotkey along with DOSBox with a batch file similar to mine:
That assumes that you saved the script as AutoHotkeyU32.ahk, since AutoHotkeyU32.exe will automatically load any script with the same base name, and that both are in the same folder as DOSBox.
Anyways, what you're trying to do could probably be done by utilizing a While loop, a Sleep(5000) command (for sleeping 5 seconds) and so on. The help file that comes with AutoHotkey is invaluable in learning how to do what you want to do, but, hopefully, what I've provided is enough to get you started.
Well..I'm not exactly sure what your trying to do, but would it be possible to create a batch file that you manually kick off do something like this for you?
@Stretch, thanks for the info 😀 I'll give that a try ASAP.
@CrosBow777, a batch file wouldn't work. What I'm trying to do is (yeah, I know... story of my life: WASTE TIME, and I'm quite easily amused 🤣!):
I'm trying to start the old DOS version of the board game "Risk" and allow just the AI (no humans) to play the game so I can sit back and watch <grin>, WITHOUT any prompts. In the game you have to occasionally press the ENTER key for various screens that pop up when playing the game. I'm looking for a DOS TSR that would simply press the ENTER key every few seconds or so, thereby closing the pop up messages in the game. Ideally the TSR could be toggled on and off via a hotkey.
Anyhow, like I said, I have no life, and am easily amused 🤣!