NULL mag Issue 09 29 Run dos apps with python
this is a strange thing... :) i recently found some old DOS cdroms, with many goodies in them and wanted to test them under my linux machine. one way was to mount the cd inside a DOSBOX instance and browse the CD via the DOS command line.
perhaps this would be a good (perhaps the only) solution back in the days, but now i am much older and i like my GUI file manager :)
so... here we are... a python script to the rescue!!! what it does, is simple. i associate the script with the DOS .EXE files and when i double click one of them, in my file manager (pcmanfm) the script runs DOSBOX with the current folder, where the DOS program is, automatically mounted and executes it instantly.
this way, you can browse large DOS CDROM collections via your file manager very easy. hope you like it and use it.
#!/usr/bin/python3
import os
import sys
import subprocess
dosbox_exe = 'dosbox'
dosbox_args = ['"D:"']
def run_dosbox(args):
arg = "-conf /home/user/scripts/doscfg.conf"
for cmd in args:
arg = arg +" -c "+cmd
arg = arg +" -c echo '"+str(sys.argv[1])+"'"
os.system(dosbox_exe+" "+arg)
run_dosbox(dosbox_args)
print (sys.argv)