Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider becoming a contibuting member by either clicking this text or the Patreon link on the right.

Patreon

If neither of those of work for you, you can donate any amount by clicking here.

Recommended Posts

Posted

This is my first post on this forum I don't know whether it has laready been done but anyway, Ive created a VBSCRIPT that creates DOSBox config Files.

This is the script:

dim oFS, oFolder, Directory, DOSBOX, RomFolder

RomFolder = "C:\Roms\Microsoft DOS\Roms\"

DOSBOX = "C:\Users\UserName\AppData\Local\DOSBox\dosbox-0.73.conf"
Directory = "C:\DOS\CDrive"

set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder(Directory)

ShowFolderDetails oFolder

sub ShowFolderDetails(oF)

dim TempDim
dim Folder
dim FolderName
dim F
dim FileName, FileNameExt
dim objFile
dim i



Set objFSO = CreateObject("Scripting.FileSystemObject")



For each Folder in oF.Subfolders

i = i +1

If i = 100 then i = 0

FolderName = Folder.Name

FileName = "NoEXE"

For each F in Folder.Files

FileNameExt= Right(F,3)


If FileNameExt = "EXE" OR FileNameExt = "exe" Then
FileName = F.Name
End If

Next


FolderName = replace(FolderName," ","")
FolderName = Left(FolderName,6) & i

TempDim = Directory & "\" & FolderName

objFSO.MoveFolder Folder, TempDim

Set objReadTextFile = objFSO.OpenTextFile(DOSBOX, 1, True)

Set objWriteToTextFile = objFSO.OpenTextFile(RomFolder & FolderName & ".conf", 2, True)



Do While Not objReadTextFile.AtEndofStream


TempDim = objReadTextFile.ReadLine

If InStr(TempDim, "# Lines in this section will be run at startup.") Then

objWriteToTextFile.WriteLine("mount C C:\DOS\CDrive")
objWriteToTextFile.WriteLine("mount D D:\ -t cdrom")
objWriteToTextFile.WriteLine("C:")
objWriteToTextFile.WriteLine("cd " & FolderName)
objWriteToTextFile.WriteLine(FileName)
Else

objWriteToTextFile.WriteLine(TempDim)
End If

Loop

objReadTextFile.Close
objWriteToTextFile.close
Next


end sub

This presumes the original DOSBox config file is "C:\Users\UserName\AppData\Local\DOSBox\dosbox-0.73.conf" Where UserName is the account where your DOSBox is installed to. The Directory variable is the Directory where your folders that contin your DOS games are. And RomFolder is where you want the Config Files to be placed. Please Note this is a script I have made for personal use and may not work for everyone. It will also rename your folders containg the DOS games to be compatible so please bare that in mind (8Characters). I would also love for someone to expand on this script. There is also no error handling so if something goes wrong sorry but you're on your own. The Script is also attached.

I am not a programmer so really this script is for experimental use only. It worked for me tho in most cases.

main.rar

  • 1 month later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...