Mac OSX Advanced

From DOSBoxWiki
Jump to: navigation, search

Once you have DOSBox up and running on Mac OSX you might want to experiment with different configuration files. With AppleScript you can easily built a little dialog that will prompt you for which configuration file you want to use for starting up DOSBox. First create a new folder in your documents folder called DOSBox, this is where we are going to store the new configuration files. As an example you can copy the default configuration file on DOSBox_and_Mac_OSX to this folder. The way we are setting this up will use the default configuration file on Mac OSX for default settings and the configuration file in your ~/Documents/DOSBox folder as an additional configuration. Please note that the additional configuration will override the settings in the default configuration, except for the settings in the AUTOEXEC section, these will add up, so it's best to not have anything in the AUTOEXEC section of your default configuration. Now start up "AppleScript Editor" (it's installed to Applications/Utilities/AppleScript, then open its preferences and on the first setting enable it to show the scriptmenu in the menu bar. This way your script is easily accessible via the Script Menu in the Menu bar, looking like a black scroll. Close the preferences and choose to make a new script (File -> New) and enter the following script:

set dosbox_path to "/Applications/"
set config_path to "/users/USERNAME/documents/dosbox/"
set the_list to ""
set nl to ASCII character 10
tell application "Finder"
set file_list to name of every file of folder "Macintosh HD:users:USERNAME:documents:dosbox"
repeat with entry in file_list
set the_list to the_list & nl & entry
end repeat
end tell
set options to (((choose from list file_list with prompt "DOSBox will start with") as string) & "'" & "&> ~/dosbox.log &")
if options is not false then
do shell script dosbox_path & " -userconf -conf '" & config_path & options
else if options is false then
do shell script dosbox_path & "&> ~/dosbox.log &"
end if

Please replace USERNAME with your username on your Mac OSX system and save the script to your script folder (~/Library/Scripts) with the name DOSBox. You can now click on the Script icon in your Menu bar and choose DOSBox in the drop down list. It will open a dialog, giving you a choice of all the configuration files in your ~/Documents/DOSBox folder. When you choose one, DOSBox will start with both the default configuration and the configuration you just chose. If you press Cancel, DOSBox will start with the default configuration ONLY. The script will also log the console output of DOSBox to ~/dosbox.log, so you can look it up if you encounter any errors.