VOGONS


First post, by omnirune

User metadata
Rank Newbie
Rank
Newbie

I'm attempting to automate the exiting of Windows 3.1 after an executable terminates, thus cleanly exiting Dosbox:

[autoexec]
# Lines in this section will be run at startup.
@echo off
mount c windows
C:\WINDOWS\SMARTDRV.EXE /L
PATH C:\WINDOWS;
SET TEMP=C:\WINDOWS\TEMP
win c:\games\arthur\arthur.exe
exit

The part that is hanging up right now is when the "arthur.exe" application is closed, I drop back into Windows 3.1. When I exit Windows, the Dosbox application terminates as expected.

Is there a method to automatically shutdown Windows 3.1 once the called upon application is closed?

Reply 1 of 20, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

You can probably modify how you launch the programs in Windows 3.1 to exit back to DOS after the proram exits and then the CLI will quit due to the "exit" command you have in [autoexec]

How To Ask Questions The Smart Way
Make your games work offline

Reply 2 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

I suppose you can do this with a custom SYSTEM.INI. Rather than having it open the default PROGMAN.EXE (Program Manager) using the "shell=" setting, you could have it open the game instead, effectively replacing the Program Manager shell with the game, turning Win3.1 into a single-task system which will close as soon as its shell (the game) terminates.

Also, get rid of the SMARTDRV line. Disk caching inside DOSBox doesn't anything useful, as the host OS does a better job at caching without interfering with the emulation.

Edit: corrected typo.

Last edited by Kippesoep on 2010-01-25, 12:42. Edited 1 time in total.

My site: Ramblings on mostly tech stuff.

Reply 3 of 20, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Kippesoep is right with the shell= command in system.ini.
I also recommend you write
Set PATH=z:\;C:\WINDOWS
since I'm not sure that just writing "PATH C:\WINDOWS; " sets it at all and you might want to keep Dosbox' built in utilities at hand (thus keeping z:\ in the path)

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 4 of 20, by IIGS_User

User metadata
Rank Oldbie
Rank
Oldbie

Or install Winexit, call it after calling your game, right in the autoexec section, just before exiting DOSBox:

http://www.win31.de/esoft.htm

Win31.de wrote:

Shuts down Windows immediately (i.e. without showing a dialogue box) when double-clicked.

Klimawandel.

Reply 5 of 20, by omnirune

User metadata
Rank Newbie
Rank
Newbie

Some great suggestions here.

Unfortunately, I am unable to run the application as the program manager replacement, so this suggestion, at least in this particular case, will not work.

The WinExit suggestion adds a nice icon to the desktop that, upon clicking, will drop back into DOS. I'm looking for a clean exit from DosBox immediately after the application closes, if possible, so that a child would not need to click the WinExit icon as the final step.

I have found numerous programs that will exit windows upon execution, such as WinExit (NOT TO BE CONFUSED WITH THE OTHER WINEXIT PROGRAM LINKED ABOVE): http://files.chatnfiles.com/WinSitedotcom/win … .zip/index.html

However, I cannot find a way that will execute the application (ex: win arthur.exe) and then execute winexit immediately after application close. If I were to add winexit.exe in the next line of the BAT, it executes after dropping out of windows.

I have tried adding winexit to the startup items, but it will terminate windows and the arthur.exe upon entry into windows.

Is there a known spawn application that, upon launching windows, I can add it to the startup items and then it will sequentially launch applications, going to the next application in the list when the first application terminates? Or is there some other way for the second item in the batch file to launch, post termination of first application, within windows 3.1?

Thanks again for the prior quick feedback!

Reply 6 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie
omnirune wrote:

Unfortunately, I am unable to run the application as the program manager replacement, so this suggestion, at least in this particular case, will not work.

If you mean that you also need access to the program manager, this is still possible. There is also a run= line in there that allows you to start PROGMAN.EXE too. It just no longer controls the main shutdown in that case.

If there's another reason as to why that wouldn't work for you, be sure to actually post the reason, as workarounds may exist.

One alternative is to create a program that actively starts the executable you need and forces a Windows shutdown once the application has terminated. Sounds like a bad thing to do and requires actual work on your part.

Oh, and batch files are of absolutely no use in this case. One cannot serialize Windows programs that way.

My site: Ramblings on mostly tech stuff.

Reply 7 of 20, by omnirune

User metadata
Rank Newbie
Rank
Newbie

The game in question is "Arthur's Teacher Trouble," a Living Books interactive story.

I copied the Arthur.exe alongside its /Data and other files directly into the windows directory. Next, in System.ini, I changed the shell to arthur.exe.

When windows launches, I get a "invalid or missing book outline file" error. I've tried copying all files into every directory in an effort to see if the active path was something other than /windows. No success.

If I restore progman.exe and launch arthur.exe from the run command inside windows 3.1 (and keeping the files copied as was in the above scenario) the application launches without error.

This is the reason why I'm attempting to find an alternative method of launching and cleanly quitting the application.. I hope this helps! 😀

Reply 8 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

Oh dear. Don't copy stuff directly into the Windows folder. Just install the program normally in its default location. Try setting the shell line to something like "shell=c:\arthur\arthur.exe" instead.
The problem could be that the program depends on a function of progman, which could potentially be solved by added progman.exe to the run= line. If it needs it running before that, there may be another problem and then you would indeed need a separate program as I described earlier.

My site: Ramblings on mostly tech stuff.

Reply 9 of 20, by omnirune

User metadata
Rank Newbie
Rank
Newbie

Ordinarily I would leave the windows directory prestine and the applications separate, but I copied the game directly into the directory as a last choice troubleshooting step.

As you have pointed out, its probable and it seems likely in this case that progman is required for the successful operation of this application. Despite adding progman.exe to the load= or run= line in win.ini, the application does not launch successfully as a shell replacement.

Thus I am looking for some technique to terminate win 3.1 upon close of application automatically, however, I am not having success in finding an application that would manage this. I believe the terminology is spawning, and an application would spawn if the state of another application changes to a defined criteria.

Thank you for your troubleshooting advice, Kippesoep.

Reply 11 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

Here you go, omnirune. I've built a simple program to fullfill that function.

Just place the runexit.exe file in a folder called "runexit" in the mounted C drive's root then start Windows 3.1 using "win c:\runexit\runexit c:\games\arthur\arthur".

My site: Ramblings on mostly tech stuff.

Reply 12 of 20, by omnirune

User metadata
Rank Newbie
Rank
Newbie

Thank you!

This worked! I had to do an additional step to get Arthur's Teacher Trouble to work:

I copied pages.512 into the c: root and changed the \data\ reference within the file to the absolute path (c:\game\arthur\data\).

This above thread will enable you to:
Launch DosBox
Automatically load Arthur's Teacher Trouble within Win 3.1
Close Win 3.1 and DosBox upon close of Arthur's Teacher Trouble

Perfect for an educational setting. Again, thank you Kippesoep. In hindsight, due to a bug in the Living Books Player, it seems if I was able to discover that I could copy "pages.512" into the root sooner, the application built by Kippesoep would have not be necessary. What is advantageous about this implementation, however, is it allows a shared /win31 installation to save disk space.

Reply 14 of 20, by Hanyouki0

User metadata
Rank Newbie
Rank
Newbie

I also wanted to thank the author of the RunExit tool. It was very useful for me!

^.^

I used it to help automate links on my Windows 7 desktop that directly start Windows 3x programs housed in DOSBox. I couldn't have done it without this!

Reply 17 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

WinG shouldn't have any trouble with it. Most likely, there's a problem with the current directory for certain programs. Be sure to read the instructions on my blog at http://www.shdon.com/blog/2013/05/25/update-to-runexit-tool

My site: Ramblings on mostly tech stuff.

Reply 18 of 20, by butterfly

User metadata
Rank Member
Rank
Member

The game loads but after I installed WinG the exit from Windows is no longer automatic - testing right now with Windows 3.0
...
I was using Windows 3.1 ... no comment