Automate exiting of Windows 3.1 post-EXE launch

Having problems with a specific game or application? Post your problems here!

Automate exiting of Windows 3.1 post-EXE launch

Postby omnirune » 2010-1-25 @ 09:02

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?
User avatar
omnirune
Newbie
 
Posts: 5
Joined: 2010-1-25 @ 08:59

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby DosFreak » 2010-1-25 @ 11:05

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]
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"People like coldplay and voted for the nazis, you can't trust people."
User avatar
DosFreak
l33t++
 
Posts: 9391
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Kippesoep » 2010-1-25 @ 11:29

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-1-25 @ 12:42, edited 1 time in total.
My site: Ramblings on mostly tech stuff.
User avatar
Kippesoep
Oldbie
 
Posts: 1015
Joined: 2005-5-04 @ 22:36
Location: Netherlands

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Dominus » 2010-1-25 @ 12:11

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)
User avatar
Dominus
DOSBox Moderator
 
Posts: 7246
Joined: 2002-10-03 @ 09:54
Location: Vienna

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby IIGS_User » 2010-1-25 @ 14:25

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.
User avatar
IIGS_User
Oldbie
 
Posts: 867
Joined: 2007-3-14 @ 19:59
Location: native_lang=ger

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby omnirune » 2010-1-25 @ 19:13

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/WinSitedotc ... 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!
User avatar
omnirune
Newbie
 
Posts: 5
Joined: 2010-1-25 @ 08:59

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Kippesoep » 2010-1-25 @ 19:21

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.
User avatar
Kippesoep
Oldbie
 
Posts: 1015
Joined: 2005-5-04 @ 22:36
Location: Netherlands

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby omnirune » 2010-1-25 @ 19:39

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! :)
User avatar
omnirune
Newbie
 
Posts: 5
Joined: 2010-1-25 @ 08:59

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Kippesoep » 2010-1-25 @ 19:45

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.
User avatar
Kippesoep
Oldbie
 
Posts: 1015
Joined: 2005-5-04 @ 22:36
Location: Netherlands

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby omnirune » 2010-1-25 @ 20:11

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.
User avatar
omnirune
Newbie
 
Posts: 5
Joined: 2010-1-25 @ 08:59

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby wd » 2010-1-25 @ 20:46

Please don't abuse the dosbox forum for completely unrelated things like this.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Kippesoep » 2010-1-26 @ 01:11

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.
User avatar
Kippesoep
Oldbie
 
Posts: 1015
Joined: 2005-5-04 @ 22:36
Location: Netherlands

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby omnirune » 2010-1-26 @ 04:11

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.
User avatar
omnirune
Newbie
 
Posts: 5
Joined: 2010-1-25 @ 08:59

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby exofreeze » 2012-8-03 @ 12:25

wanted to post a thanks for this. It ended up being extremely useful for a project I am working on as well.
User avatar
exofreeze
Member
 
Posts: 343
Joined: 2007-3-19 @ 17:55
Location: Dallas, TX

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Hanyouki0 » 2013-5-23 @ 00:41

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!
User avatar
Hanyouki0
Newbie
 
Posts: 1
Joined: 2013-5-23 @ 00:03

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby butterfly » 2013-11-26 @ 17:33

Me too now! Thanks!
User avatar
butterfly
Member
 
Posts: 384
Joined: 2004-2-13 @ 10:36
Location: Italy

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby butterfly » 2013-12-01 @ 20:34

Aw no! RUNEXIT doesn't work after installing WinG (not sure which version)
User avatar
butterfly
Member
 
Posts: 384
Joined: 2004-2-13 @ 10:36
Location: Italy

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Kippesoep » 2013-12-01 @ 20:47

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.
User avatar
Kippesoep
Oldbie
 
Posts: 1015
Joined: 2005-5-04 @ 22:36
Location: Netherlands

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby butterfly » 2013-12-02 @ 17:50

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
User avatar
butterfly
Member
 
Posts: 384
Joined: 2004-2-13 @ 10:36
Location: Italy

Re: Automate exiting of Windows 3.1 post-EXE launch

Postby Kippesoep » 2013-12-02 @ 18:04

What game is it?
My site: Ramblings on mostly tech stuff.
User avatar
Kippesoep
Oldbie
 
Posts: 1015
Joined: 2005-5-04 @ 22:36
Location: Netherlands

Next

Return to DOSBox Games/Apps

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest