| !Run file for MSC 0.38 or later

| First clean up possible 'left overs' from earlier installations and set a pointer to the application directory.
Unset MSC$*
Run <Obey$Dir>.!Boot

| Create a Choices and a Scrap directory.
If "<Choices$Write>" <> "" Then CDir <Choices$Write>.MSC
CDir <Wimp$ScrapDir>.MSC

| Set the name of the settings file, depending on the presence of a modern Choices structure.
If "<Choices$Write>" = "" Then Set MSC$Choices <MSC$Dir> Else Set MSC$Choices <Choices$Write>.MSC
Set MSC$Settings <MSC$Choices>.Settings

| If no Settings file exists, copy the Example file.
IfThere <MSC$Settings> Then Else Copy <MSC$Dir>.Example <MSC$Settings> A~C~D~F~LN~P~Q~R~S~T~V

| Some modules which are absolutely necessary...
RMEnsure Internet 0.00 Error MSC requires the Internet module
RMEnsure Resolver 0.00 Error MSC requires the Resolver module

| Start up SysLog if it isn't already running.
If "<SysLog$Dir>"="" Then If "<SysLog$LogDir>"="" Then Error !SysLog application not seen by filer
RMEnsure SysLog 0.17 Run <SysLog$Dir>.!Run
RMEnsure SysLog 0.17 Error MSC needs SysLog 0.17 or later

| Try to load the Secure Sockets module, but don't error if it can't be found.
| You can of course change these lines if the module can be found elsewhere on your machine.
RMEnsure SecureSockets 0.00 IfThere System:Modules.Secure Then RMLoad System:Modules.Secure
RMEnsure SecureSockets 0.00 IfThere <MSC$Dir>.Secure Then RMLoad <MSC$Dir>.Secure

| Try to load the AcornSSL module and stuff it needs, but don't error if it can't be found.
| You can of course change these lines if the module can be found elsewhere on your machine.
RMEnsure Toolbox 0.00 IfThere System:Modules.Toolbox.Toolbox Then RMLoad System:Modules.Toolbox.Toolbox
RMEnsure Window 0.00 IfThere System:Modules.Toolbox.Window Then RMLoad System:Modules.Toolbox.Window
RMEnsure AcornSSL 1.06 IfThere System:Modules.Network.URL.AcornSSL Then StartDesktopTask RMRun System:Modules.Network.URL.AcornSSL
RMEnsure AcornSSL 1.06 IfThere <Obey$Dir>.AcornSSL Then StartDesktopTask RMRun <Obey$Dir>.AcornSSL

| Change to 256 to get debugging messages.
SysLog MSC 125

| Check that this is the most recent version.
StartDesktopTask <MSC$Dir>.VerCheck MSC <MSC$Dir>.!RunImage <MSC$Choices> 1

| Set a Mail$Dir variable if this doesn't exist yet.
If "<Mail$Dir>" = "" Then If "<AntiSpam$MailDir>" <> "" Then Set Mail$Dir <AntiSpam$MailDir>
If "<Mail$Dir>" = "" Then If "<POPstar$MailDir>" <> "" Then Set Mail$Dir <POPstar$MailDir>
If "<Mail$Dir>" = "" Then Set Mail$Dir <MSC$Choices>.MailDir

IfThere <Mail$Dir> Then Else StartDesktopTask <MSC$Dir>.ShowText Message from MSC (click to close)`]|KMailDir has been created in <MSC$Choices>, but you must create the correct subdirectories yourself (see !Help).
IfThere <Mail$Dir> Then Else CDir <Mail$Dir>

| Set the wimp slot and start the program.
Wimpslot -min 32K -max 32K
Run <MSC$Dir>.!RunImage %*0
