VOGONS


First post, by lukeman3000

User metadata
Rank Member
Rank
Member

I'm wondering if I can delay the launching of a game by a specified number of seconds with some parameter I might be able to add to the DOSBox conf file, perhaps in the autoexec section?

Reply 1 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You can use the sleep utility program from FreeDOS in DOSBox. Alternatively, the 4DOS shell has a delay command.

Reply 2 of 6, by lukeman3000

User metadata
Rank Member
Rank
Member

So, I'm using D-Fend Reloaded to launch the game. I also need to launch midiplayer.exe and make sure that it has enough time to fully initialize (since it's the mt-32 emulator) before my game launches. Here's the batch file I'm using that I pointed D-Fend Reloaded to:

cd "..\..\..\Sound"
start "" "mt32.exe"
timeout /T 5 /nobreak > NUL
cd ".\"
SCIV.exe

mt32.exe is an autohotkey script that launches midiplayer.exe. So the idea is that after starting midiplayer, the script waits 5 seconds and then continues with the launching of SCIV.exe, which is the exe for Space Quest III. However, the problem is that D-Fend Reloaded seems to just blow right past the timeout and launch SCIV.exe simultaneously with the first start command. Any ideas how I might be able to structure this so that the timeout will actually be used?

Reply 3 of 6, by Osprey

User metadata
Rank Member
Rank
Member

You could put your timeout in the AutoHotkey script. I think that that would make the most sense. Make your AutoHotkey script like so:

Run, <path_to_midiplayer.exe>, , Hide
Sleep, 5000

Oh, and you'd need to remove the "start" from the line calling the script, so that it waits for it to finish.

Another option is 4DOS' "delay" command. Follow my instructions in this thread and then add the following...

4DOS.com /c delay 5

...to your [autoexec] section in place of your "timeout" command.

BTW, I don't know if you can make D-Fend launch a batch file, but I like running games that I use AutoHotKey with via batch file, since I can then terminate AutoHotKey when done, like so:

start AutoHotkeyU32.exe
DOSBox.exe <path_game_exe> -noconsole -exit
taskkill /IM AutoHotkeyU32.exe

Reply 4 of 6, by lukeman3000

User metadata
Rank Member
Rank
Member
Osprey wrote:
You could put your timeout in the AutoHotkey script. I think that that would make the most sense. Make your AutoHotkey script li […]
Show full quote

You could put your timeout in the AutoHotkey script. I think that that would make the most sense. Make your AutoHotkey script like so:
Another option is 4DOS' "delay" command. Follow my instructions in this thread and then add the following...

4DOS.com /c delay 5

...to your [autoexec] section in place of your "timeout" command.]

This solution worked perfectly. Thanks!

That said, I do have a couple questions:

1. Just out of curiosity, how might I implement ripsaw's first suggestion of using sleep from freedos?

2. When I installed D-Fend Reloaded, I think it installed FREEDOS. Inside the folder are some 4DOS files. How might I tell if that one is newer or older than the binary you linked to? The one you linked to is bigger in filesize. Also, the one you linked to seems to initialize much faster than the 4dos inside of the freedos folder. I.e., after typing "4dos" and pressing enter on the dosbox command line, the one you linked to loads about 1-2 seconds quicker. Can I just replace the one inside of the freedos folder with the one I just downloaded, or would that cause some problems with the rest of freedos?

3. When putting 4DOS.com /c delay 5 in autoexec, I had to put change to the c: directory first, otherwise dosbox couldn't find 4dos.com. DOSBox seems to default to the Z directory, but I can't figure out where this exists in my folder structure. When I run dir, it returns the following files:

COMMAND.COM
AUTOEXEC.BAT
KEYB.COM
IMGMOUNT.COM
LOADROM.COM
BOOT.COM
INTRO.COM
RESCAN.COM
LOADFIX.COM
MEM.COM
MOUNT.COM
MIXER.COM
CONFIG.COM

And only those files. I can't find a folder with only those 13 files anywhere, otherwise I'd just drop 4DOS.com in that folder and not worry about changing directories. Any ideas where this Z directory might exist?

Reply 5 of 6, by Osprey

User metadata
Rank Member
Rank
Member
lukeman3000 wrote:

1. Just out of curiosity, how might I implement ripsaw's first suggestion of using sleep from freedos?

I don't know. I've never used FreeDOS. I was going to try it out the other day, but saw only links to installers and boot images at its website and didn't bother. What I like about 4DOS is that you can just extract the executable directly from the downloaded zip and run it in DOSBox, without installation or booting into it.

lukeman3000 wrote:

2. When I installed D-Fend Reloaded, I think it installed FREEDOS. Inside the folder are some 4DOS files. How might I tell if that one is newer or older than the binary you linked to? The one you linked to is bigger in filesize. Also, the one you linked to seems to initialize much faster than the 4dos inside of the freedos folder. I.e., after typing "4dos" and pressing enter on the dosbox command line, the one you linked to loads about 1-2 seconds quicker. Can I just replace the one inside of the freedos folder with the one I just downloaded, or would that cause some problems with the rest of freedos?

Again, I haven't used FreeDOS, so I'm not sure, but my hunch is that you could replace it, since 4DOS is self-contained in 4DOS.com. As for finding the version, it tells you when you run 4DOS and hit enter. The one that I linked to says that it's version 8.00. I would imagine that the other one that you're talking about probably says that or 7.xx.

lukeman3000 wrote:
3. When putting 4DOS.com /c delay 5 in autoexec, I had to put change to the c: directory first, otherwise dosbox couldn't find 4 […]
Show full quote

3. When putting 4DOS.com /c delay 5 in autoexec, I had to put change to the c: directory first, otherwise dosbox couldn't find 4dos.com. DOSBox seems to default to the Z directory, but I can't figure out where this exists in my folder structure. When I run dir, it returns the following files:

COMMAND.COM
AUTOEXEC.BAT
KEYB.COM
IMGMOUNT.COM
LOADROM.COM
BOOT.COM
INTRO.COM
RESCAN.COM
LOADFIX.COM
MEM.COM
MOUNT.COM
MIXER.COM
CONFIG.COM

And only those files. I can't find a folder with only those 13 files anywhere, otherwise I'd just drop 4DOS.com in that folder and not worry about changing directories. Any ideas where this Z directory might exist?

The Z drive and the location that it represents don't exist except in DOSBox. It's a virtual disk (think of it as a boot disk) that DOSBox creates for its DOS commands. When DOSBox launches, it unpacks those commands from DOSBox.exe into memory and mounts that area of memory as a drive, the Z drive. You can't write to it or really do anything to or with it. That's why the mount command is so important. Even if you put 4DOS.com or anything else in the folder where DOSBox is, you still have to mount that folder or a folder above it and then change to that directory in order to access it.

Reply 6 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author
lukeman3000 wrote:

1. Just out of curiosity, how might I implement ripsaw's first suggestion of using sleep from freedos?

I linked the download page in my comment. Just download sleep.zip, extract the program from the BIN folder in the archive, and run it in DOSBox like "sleep 5". It's really not that different or more complicated than using 4DOS.