Difference between revisions of "Mac OSX Advanced"

From DOSBoxWiki
Jump to navigationJump to search
(Undo spam revision 4057 by Seo5200 (Talk))
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
Once you have DOSBox up and running on Mac OSX you might want to experiment with different [[Dosbox.conf|configuration files]]. With AppleScript you can easily built a little dialog that will prompt you for which [[Dosbox.conf|configuration file]] you want to use for starting up DOSBox.
 
Once you have DOSBox up and running on Mac OSX you might want to experiment with different [[Dosbox.conf|configuration files]]. With AppleScript you can easily built a little dialog that will prompt you for which [[Dosbox.conf|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 [[Dosbox.conf|configuration files]]. As an example you can copy the default [[Dosbox.conf|configuration file]] on [[DOSBox_and_Mac_OSX]] to this folder.
 
First create a new folder in your documents folder called DOSBox, this is where we are going to store the new [[Dosbox.conf|configuration files]]. As an example you can copy the default [[Dosbox.conf|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 not that the additional configuration will override the settings in the default configuration, except for the settings in the [[AUTOEXEC]] [[Dosbox.conf#.5Bautoexec.5D|section]], these will add up, so it's best to not have anything in the [[AUTOEXEC]] [[Dosbox.conf#.5Bautoexec.5D|section]] of your default configuration.
+
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]] [[Dosbox.conf#.5Bautoexec.5D|section]], these will add up, so it's best to not have anything in the [[AUTOEXEC]] [[Dosbox.conf#.5Bautoexec.5D|section]] of your default configuration.
Now start up "AppleScript Editor" (it's installed to Applications/Utilities/AppleScript Editor.app), then open its preferences and on the first setting enale 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.
+
Now start up "AppleScript Editor" (it's installed to Applications/Utilities/AppleScript Editor.app), 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 preferneces and choose to make a new script (File -> New) and enter the following script:
+
Close the preferences and choose to make a new script (File -> New) and enter the following script:
  
 +
set dosbox_path to "/Applications/DOSBox.app/Contents/MacOS/dosbox"
 +
set config_path to "/users/USERNAME/documents/dosbox/"
 
  set the_list to ""
 
  set the_list to ""
 
  set nl to ASCII character 10
 
  set nl to ASCII character 10
Line 13: Line 15:
 
  end repeat
 
  end repeat
 
  end tell
 
  end tell
  set options to (((choose from list file_list with prompt "DOSBox will start with") as string) & "'" & "&> /~/dosbox.log &")
+
  set options to (((choose from list file_list with prompt "DOSBox will start with") as string) & "'" & "&> ~/dosbox.log &")
 
  if options is not false then
 
  if options is not false then
  do shell script "/Applications/DOSBox.app/Contents/MacOS/dosbox -conf '/users/USERNAME/library/preferences/DOSBox 0.73 Preferences' -conf '/users/USERNAME/documents/dosbox/" & options
+
  do shell script dosbox_path & " -userconf -conf '" & config_path & options
 
  else if options is false then
 
  else if options is false then
  do shell script "/Applications/DOSBox.app/Contents/MacOS/dosbox &> ~/dosbox.log &"
+
  do shell script dosbox_path & "&> ~/dosbox.log &"
 
  end if
 
  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.
 
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.
 
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 ~/dobox.log, so you can look it up if you encounter any errors.
+
The script will also log the console output of DOSBox to ~/dosbox.log, so you can look it up if you encounter any errors.

Latest revision as of 01:49, 13 October 2010

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 Editor.app), 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/DOSBox.app/Contents/MacOS/dosbox"
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.