VOGONS


First post, by rfnagel

User metadata
Rank Oldbie
Rank
Oldbie

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.

Unload TSR.

Has anyone ever heard of anything like this?

Rich ¥Weeds¥ Nagel
http://www.richnagel.net

Reply 1 of 5, by Osprey

User metadata
Rank Member
Rank
Member

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:

#SingleInstance Force
SetTitleMatchMode 2
SendMode Event

#If WinActive("DUNE2")
{
; Middle mouse button: Build/Place/Attack
mbutton::send {sleep 2}{b}{p}{a}{sleep 2}

; Right mouse button: Harvest/Move (works for attacking in most cases)
rbutton::send {sleep 2}{h}{m}{sleep 2}{lbutton}

; Open Options menu with Esc key
Esc::send {esc}{f2}

; Navigate map & production screen with mouse wheel
WheelUp::send {up}
WheelDown::send {down}
WheelLeft::send {left}
WheelRight::send {right}
}

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:

start AutoHotkeyU32.exe
DOSBox.exe ..\Game\Dune2.exe -noconsole -exit
taskkill /IM AutoHotkeyU32.exe

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.

Reply 2 of 5, by rfnagel

User metadata
Rank Oldbie
Rank
Oldbie

Many thanks for the detailed and informative reply, but I'm running DOSBox ("DOSBox Turbo") on an Android tablet.

Rich ¥Weeds¥ Nagel
http://www.richnagel.net

Reply 3 of 5, by Stretch

User metadata
Rank Oldbie
Rank
Oldbie

Bret Johnson's scancode program should work since it can do macros.

Win 11 - Intel i7-1360p - 32 GB - Intel Iris Xe - Sound Blaster G8

Reply 4 of 5, by CrossBow777

User metadata
Rank Member
Rank
Member

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?

g883j7-2.png
Midi Modules: MT-32 (OLD), MT-200, MT-300, MT-90S, MT-90U, SD-20

Reply 5 of 5, by rfnagel

User metadata
Rank Oldbie
Rank
Oldbie

@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 🤣!

Rich ¥Weeds¥ Nagel
http://www.richnagel.net