VOGONS


First post, by pedrazzisoilmec

User metadata
Rank Newbie
Rank
Newbie

Hi everybody,
I'm new to DosBox, but I have found it deeply buried in a third-part MATLAB (!) application that I have to use.
DosBox is launched there with the purpose of executing old dos-type scientific software, that probably would not run under XP. It is run with the -noconsole option, and the .exe to run are coded in the [autoexec] part of the dosbox.conf file, that finally terminates with "exit"

My problem (and my question) is: could it be possible to avoid the "opening" of the DosBox window, that overrides all other opened windows and jumps in the foreground? Actually I do not need to see the output of the .exe, at least not always. What I would like is an option like "-background", or "-nowindow" 😀

Could you devise some way to do this in a relatively simple way?

I hope not being OT here, and I do have read the FAQ.

Best regards and thanks in advance

Claudio

Reply 1 of 16, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You would have to look if SDL supports some sort of dumb screen mode.
DOSBox asks on SDL for a screen to draw on. DOSBox can't be easily changed and it doesn't match the goal of DOSBox which is to run DOS games.

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 16, by Jorpho

User metadata
Rank l33t++
Rank
l33t++

Can't you edit the line that launches DOSBox to use the Windows "Start" command instead of DOSBox.exe directly? I'm pretty sure the "Start" command has switches that allow you to launch a program minimized.

Reply 3 of 16, by mr_bigmouth_502

User metadata
Rank Oldbie
Rank
Oldbie

I think that there should be a version of dosbox specifically made for running old business/scientific/industrial applications.

Reply 4 of 16, by HunterZ

User metadata
Rank l33t++
Rank
l33t++
mr_bigmouth_502 wrote:

I think that there should be a version of dosbox specifically made for running old business/scientific/industrial applications.

It does seem that there is significant user demand for that purpose, but the DOSBox developers have their own philosophies and goals. Fortunately it's open source, so someone could always fork it.

Reply 5 of 16, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I think that there should be a version of dosbox specifically made for running old business/scientific/industrial applications.

No there shouldn't.

Reply 6 of 16, by pedrazzisoilmec

User metadata
Rank Newbie
Rank
Newbie

OK, thanks a lot to everyone. I can understand your point, that DOSBox is not the right tool for my application... (actually I did not choose it myself).
I tried almost all what was suggested, but DOSBox keeps on 😀 jumping in the foreground.
Never mind. If some readers know an emulator that could do the same job, but not oriented to games emulation, I would be grateful of an indication.
Best regards
Claudio

Reply 7 of 16, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

CheckOut AutoHotKey (if you are on Windows). I am sure you can script AHK to minimize the DOSBox window(s).

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 9 of 16, by pedrazzisoilmec

User metadata
Rank Newbie
Rank
Newbie

MiniMax,
yes I'm on Windows. I did not know the AutoHotKey, I am checking it, but is that true that it needs "active" action from the user (i.e. pressing a combination of keys)? My problem is that the application keeps launching two (!) DosBox(es) at a time, and their windows keep popping up, for hours (it is a long-running CPU intensive job). An hotkey could help, but if I am understanding correctly would not not be the solution I am looking for. Nevertheless I'll have a look.

DosFreak,
thanks... would that executable close also the DosBox window? I'm afraid 🙁 I don't know what the NTVDM window is....

Thanks to both for your suggestion and advice
Claudio

Reply 10 of 16, by MiniMax

User metadata
Rank Moderator
Rank
Moderator
pedrazzisoilmec wrote:

but is that true that it needs "active" action from the user (i.e. pressing a combination of keys)?

Not really. AHK scripts can run in the background and automatically check for certain events, like a window popping up.

Here is something I cobbled together once that might serve as a starting point for you. Its purpose is to always make the DOSBox window appear in the top-left corner of the screen. It should not be that difficult to make it hide the window instead:

#NoEnv                                          ; Avoid looking up empty variables in the environment.
#Persistent ; This script should always be running.

SetTimer, DOSBoxMonitor, 1000 ; Look for a new DOSBox window every 1 sec.
return

DOSBoxMonitor:
IfWinNotExist, DOSBox,,DOSBox Status Window ; If no DOSBox window exist, start an automatic
SetTimer, DOSBoxRepos, 500 ; re-position timer.
return ; Otherwise, we assume that is has already been
; been re-positioned.
DOSBoxRepos:
IfWinExist, DOSBox,,DOSBox Status Window ; If a DOSBox window is detected,
{ ; re-position both windows.
WinMove, DOSBox,,0,0,,,DOSBox Status Window ; Move the main window to top-left corner.
WinMove, DOSBox Status Window,,0,450 ; Move the status window below the main window.
SetTimer, DOSBoxRepos, Off ; Now that this DOSBox has been re-positioned,
; stop with the re-positioning.
}
return
Last edited by MiniMax on 2009-09-17, 15:17. Edited 1 time in total.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 11 of 16, by Zorbid

User metadata
Rank Member
Rank
Member

The "NTVDM" window is actually a CMD window. CMD.exe is the command line interface to Windows NT (like COMMAND.COM for DOS and WIN9x). That window is used by DOSBox for log and error messages, but it is optional. You can reduce the number of windows to one by using the "-noconsole" argument, or by launching the "DOSBox (no console) shortcut.

To instantly minimize the DOSBox window, you can use the Windows scripting host.

Save this in the DOSBox folder as dbx.js:

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("dosbox.exe -noconsole",7);
WScript.Sleep(100);
WshShell.AppActivate("DOSBox");
WshShell.SendKeys("% n");

If you don't use an english version of windows, replace the "n" in the "% n" line by the appropriate letter (it's the keyboard shortcut for "minimize" from the ALT+Space menu).

the .js file can be launched like any windows executable file .exe file (double click from the explorer, or by calling it from the command line).

Reply 12 of 16, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Don't know where my head is today. Must have NTVDM on the brain. I think I saw he was running a DOS app and threw NTVDM in there. heh.

This utility I mentioned is only is for the Windows command prompt, not for DOSBox.

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

Reply 13 of 16, by Zorbid

User metadata
Rank Member
Rank
Member

My method doesn't actually work... I think I got it to work the first time I tested it, but I cant reproduce it anymore, and I'm starting to think that I hid the DOSBox window under another one by accident... or it is perhaps timing sensitive, and I got it to work out of luck the first time... But I'm messing with the sleep delay (milliseconds) but it doesn't seem to help.

The script works with other notepad, though, so this seems a DOSBox (or SDL?) problem. DOSBox seems to be deaf to the SendKeys command... Weird stuff.

Edit: Apparently, it's an SDL issue, ScummVM is affected as well.

The DOSBox shell actually captures the ALT+Space combo (which is understandable), but you can't send any key to DOSBox through the SendKeyx command. I guess DOSBox captures the keyboards events at a lower level... What's more surprising is the fact that the SDL window is also deaf during the splash screen.

MiniMax, did you try your method? Is it working?

Reply 14 of 16, by Zorbid

User metadata
Rank Member
Rank
Member

The following ahk script launches DOSBox and minimizes it.
It needs to be in the DOSBox folder, or you can optionally use the SetWorkingDir option.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
;SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

Run dosbox.exe -noconsole
WinWait DOSBox
WinActivate DOSBox
WinMinimize DOSBox

I've attached a compiled version (put it in the DOSBox directory as well).

Reply 15 of 16, by pedrazzisoilmec

User metadata
Rank Newbie
Rank
Newbie

Thanks Zorbid,
I'm going to try it...
Best regards
Claudio

Reply 16 of 16, by madmike6

User metadata
Rank Newbie
Rank
Newbie

I had a similar requirement to run a small 16-bit command-line utility (ENVTIME.EXE) in x64 using DOSBox.
I couldn't start DOSBox minimized but managed to run DOSBox from a batch file without having the GUI window:

SET SDL_VIDEODRIVER=dummy
{path_to_DOSBOX_exe}\DOSBox.exe ENVTIME.EXE -noconsole -exit

The "dummy" videodriver will cause the GUI window not to popup. The -noconsole causes the console not to popup and -exit causes DOSBox to exit after running the executable (ENVTIME.EXE in this case). Replace ENVTIME.EXE with whatever executable or batch file for your case.