Category : Communication (modem) tools and utilities
Archive   : MRUN200.ZIP
Filename : MAILRUN.WAS

 
Output of file : MAILRUN.WAS contained in archive : MRUN200.ZIP
;MailRun v2.00: Automated BBS Communications
;1992 Gerald P. Sully, all rights reserved.


#comment
*************************************************************
*************************************************************

The source code for MailRun is contained in 9 separate files:
MAILRUN.WAS (this file), MRUN200.H (a header file), and files
named MRUN200?.WAS, where ? is a letter A through G. MailRun
also requires the files MRUNICON.DLL and MRUNBKG.BMP in order
to display the icon bar.

MAILRUN.WAS is the script from which the other script files
are run. It performs a brief initialization to find the
location of its support files, then chains to MRUN200A.WAS,
which is the principle engine of MailRun. It will also
perform an install routine if it finds that there is no
current MAILRUN.INI file.

The key files of MailRun are the *.MRN files. These
store configuration information and control what tasks
will be performed on each BBS. The user interface is
designed to provide a convenient way to edit these files
and display their contents. The files are standard INI
files, and so may also be edited by hand. The comm engine
reads the currently loaded *.MRN file, calls each BBS and
executes each pending task.

*************************************************************
*************************************************************
#endcomment



#define IniFile 0

string MailRunIni, MailRunList, MailRunTrunc, MailRun
string MailRunDir, MailDir, ReplyDir, DownloadDir, UploadDir, TempDir
string DialAttempts, DialTimeout, DialPause, IdleTimeout, SavePackets
string Archiver, QWKReader, LogViewer
integer LogRun, AppendLog, AnsiInLog, NewfileFilter, HelpPage


#comment
********************************************************

MAIN()

Calls makefullname(), checkfile(), checkdir(), makeini(),
delspec(), changesettings(), movefiles(), updateidx(),
updatemrn(), gettempdir()

Executes MRUN200A.WAX

Checks for existence of MAILRUN.INI file, then chains
to the main body of the script.

********************************************************
#endcomment

proc main
string MRunMain, temp, MailRunHelp
integer Version
temp = makefullname($DEFAULTPATH, "mailrun.hlp")
MailRunHelp = makefullname($PWTASKPATH, "mailrun.hlp")
if isfile temp
copyfile temp MailRunHelp
delfile temp
endif
set aspect helpfile "mailrun.hlp"
MailRunIni = makefullname($WINPATH, "MAILRUN.INI")
profilerd MailRunIni "MailRun" "Version" Version
if !(checkfile(MailRunIni)) || (Version != 2)
;if there is no .INI file for version 2.0, run install procedure
makeini()
changesettings()
movefiles()
updatemrn()
statmsg "Installation complete!"
endif

;Create the temporary directory
gettempdir()
if checkdir(0, TempDir, "")
halt
endif
;Make sure the Temp directory is empty
delspec(TempDir, "*.*")
profilerd MailRunIni "MailRun" "MailRunDir" MailRunDir
MRunMain = makefullname(MailRunDir, "MRUN200A")
execute MRunMain
endproc


#comment
********************************************************

DELSPEC()

Called by main()

Calls makefullname()

Deletes specified filespec from specified directory.

********************************************************
#endcomment

proc delspec
strparm dirname, spec
string filename, filespec
FileSpec = makefullname(dirname, spec)
findfirst FileSpec
while FOUND
FileName = makefullname(dirname, $FILENAME)
delfile FileName
findnext
endwhile
endproc


#comment
********************************************************

MAKEINI()

Called by main()

Calls welcomebox()

Creates the MAILRUN.INI file and sets default values.

********************************************************
#endcomment

proc makeini
string StateDLPath, StateULPath
integer dialogstatus
integer StateWaitCnct, StateCallPause, StateMaxDial
welcomebox()
dialogstatus = $DIALOG
;Check whether user wishes to continue
while dialogstatus != 1
if dialogstatus == 10
exitwhile
endif
dialogstatus = $DIALOG
endwhile
;if not, halt the script
if dialogstatus == 1
halt
endif

;Create the file MAILRUN.INI

fopen IniFile MailRunIni CREATE TEXT
if FAILURE
errormsg "Unable to create MAILRUN.INI;`r`nscript aborted...."
halt
endif
fputs IniFile "[MailRun]"
fputs IniFile "Version=2.00"
fputs IniFile "MailRun=mailrun.mrn"
fputs IniFile "MailRunDir="
fputs IniFile "MailDir="
fputs IniFile "ReplyDir="
fputs IniFile "DownloadDir="
fputs IniFile "UploadDir="
fputs IniFile "DialAttempts="
fputs IniFile "DialTimeout="
fputs IniFile "DialPause="
fputs IniFile "IdleTimeout=120"
fputs IniFile "SavePackets=3"
fputs IniFile "LogRun=1"
fputs IniFile "AppendLog=0"
fputs IniFile "AnsiInLog=0"
fputs IniFile "NewfileFilter=0"
fputs IniFile "Archiver="
fputs IniFile "QWKReader="
fputs IniFile "LogViewer="
fputs IniFile "DLSortField=0"
fputs IniFile "ULSortField=0"
fputs IniFile "ExecTime=HH:MM:SS"
fputs IniFile ""
fputs IniFile "[BBSTypes]"

fputs IniFile "BBSType_1=PCBoard 14.5"
fputs IniFile "BBSType_2=WildCat! 3.5"
fputs IniFile "BBSType_3=Auntie"
fputs IniFile ""
fputs IniFile "[MailDoors]"
fputs IniFile "MailDoor_1=QMail"
fputs IniFile "MailDoor_2=MarkMail"
fputs IniFile "MailDoor_3=Cam-Mail"
fputs IniFile "MailDoor_4=RoseMail"
fputs IniFile "MailDoor_5=TomCat"
fputs IniFile "MailDoor_6=Auntie Mail"
fputs IniFile ""
fputs IniFile "[DEFAULT]"
fputs IniFile "BBSName="
fputs IniFile "BBSType=PCBoard 14.5"
fputs IniFile "MailDoorType=QMail"
fputs IniFile "Number_1="
fputs IniFile "Number_2="
fputs IniFile "Number_3="
fputs IniFile "UserName="
fputs IniFile "PWord="
fputs IniFile "Confirm1="
fputs IniFile "Confirm2="
fputs IniFile "XFerProt=ZModem"
fputs IniFile "MailXFerProt=ZModem"
fputs IniFile "QWKArchiver=pkunzip.exe"
fputs IniFile "LangNumber="
fputs IniFile "GraphicsOn=1"
fputs IniFile "LangPrompt=Language"
fputs IniFile "GraphicsPrompt=graphics (Enter)"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "Confirm1Prompt="
fputs IniFile "Confirm2Prompt="
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=More?"
fputs IniFile "FilePrompt="
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Command?"
fputs IniFile "DLPrompt=Aborts Transfer"
fputs IniFile "DLUnavPrompt=(Enter)=none"
fputs IniFile "ULPrompt=Aborts Transfer"
fputs IniFile "ULDescPrompt=? ("
fputs IniFile "MailDoor=QM"
fputs IniFile "MailPrompt=QMail Command"
fputs IniFile "ReceiveQWKPrompt=these messages"
fputs IniFile "MailDLPrompt=Prepare to download"
fputs IniFile "MailULPrompt=Prepare to upload"
fputs IniFile ""
fputs IniFile "[PCBoard 14.5]"
fputs IniFile "LangPrompt=Language"
fputs IniFile "GraphicsPrompt=graphics (Enter)"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=More?"
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Command?"
fputs IniFile "DLPrompt=Aborts Transfer"
fputs IniFile "DLUnavPrompt=(Enter)=none"
fputs IniFile "ULPrompt=Aborts Transfer"
fputs IniFile "ULDescPrompt=? ("
fputs IniFile ""
fputs IniFile "[WildCat! 3.5]"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=[S]top"
fputs IniFile "FilePrompt=FILE MENU"
fputs IniFile "ContinuePrompt=ontinue"
fputs IniFile "CommandPrompt=MAIN MENU"
fputs IniFile "DLPrompt=Please begin"
fputs IniFile "DLUnavPrompt=file # 1"
fputs IniFile "ULPrompt=Please begin"
fputs IniFile "ULDescPrompt=Description?"
fputs IniFile ""
fputs IniFile "[Auntie]"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "ViewPrompt=Bulletin:"
fputs IniFile "FilePrompt=File Area"
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Main Area"
fputs IniFile "DLPrompt=Ctrl+X"
fputs IniFile "DLUnavPrompt=choice (1"
fputs IniFile "ULPrompt=Ctrl+X"
fputs IniFile "ULDescPrompt=1 ?"
fputs IniFile ""
fputs IniFile "[QMail]"
fputs IniFile "MailDoor=QM"
fputs IniFile "MailPrompt=QMail Command"
fputs IniFile "ReceiveQWKPrompt=these messages"
fputs IniFile "MailDLPrompt=Prepare to download"
fputs IniFile "MailULPrompt=Prepare to upload"
fputs IniFile ""
fputs IniFile "[MarkMail]"
fputs Inifile "MailDoor=MM"
fputs IniFile "MailPrompt=MarkMail Command"
fputs IniFile "ReceiveQWKPrompt=When Done"
fputs IniFile "MailDLPrompt=Aborts Transfer"
fputs IniFile "MailULPrompt=Aborts Transfer"
fputs IniFile ""
fputs IniFile "[RoseMail]"
fputs IniFile "MailDoor=RM"
fputs IniFile "MailPrompt=RoseMail Command"
fputs IniFile "ReceiveQWKPrompt=this Packet"
fputs IniFile "MailDLPrompt=Prepare to download"
fputs IniFile "MailULPrompt=Prepare to upload"
fputs IniFile ""
fputs IniFile "[Cam-Mail]"
fputs IniFile "MailDoor=CM"
fputs IniFile "MailPrompt=Cam-Mail Command"
fputs IniFile "ReceiveQWKPrompt=these messages"
fputs IniFile "MailDLPrompt=Prepare to download"
fputs IniFile "MailULPrompt=Prepare to upload"
fputs IniFile ""
fputs IniFile "[TomCat]"
fputs IniFile "MailDoor=T"
fputs IniFile "MailPrompt=TOMCAT MENU"
fputs IniFile "ReceiveQWKPrompt=when done"
fputs IniFile "MailDLPrompt=Start your"
fputs IniFile "MailULPrompt=Start your"
fputs IniFile ""
fputs IniFile "[Auntie Mail]"
fputs IniFile "MailDoor="
fputs IniFile "MailPrompt="
fputs IniFile "ReceiveQWKPrompt="
fputs IniFile "MailDLPrompt=Ctrl+X"
fputs IniFile "MailULPrompt=Ctrl+X"
fclose IniFile
MailRun = MailRunIni

;suggest default values based on current system settings

fetch dialdir maxdial StateMaxDial
fetch dialdir waitcnct StateWaitCnct
fetch dialdir callpause StateCallPause
fetch dnldpath StateDLPath
fetch upldpath StateULPath
MailRunDir = makefullname($PWTASKPATH, "mailrun")
DownloadDir = StateDLPath
UploadDir = StateULPath
MailDir = StateDLPath
ReplyDir = StateULPath
itoa StateMaxDial DialAttempts
itoa StateWaitCnct DialTimeout
itoa StateCallPause DialPause
MailRunList = "MAILRUN.INI"
MailRunTrunc = "MAILRUN.INI"
IdleTimeout = "120"
SavePackets = "3"
LogRun = 1
AppendLog = 0
AnsiInLog = 0
NewfileFilter = 0
endproc


#comment
********************************************************

CHANGESETTINGS()

Called by main()

Calls checkdir(), settingsbox()

Allows the user to change the defaults in MAILRUN.INI.

********************************************************
#endcomment

proc changesettings
string LastMRunDir, LastMailDir, LastReplyDir
string LastDLDir, LastULDir
string SaveMsg = "You have not saved your MailRun settings. \
Select `"OK`" to return, `"Cancel`" to abort MailRun."
integer MakeDirError = 0
integer dialogstatus, savestatus
integer Response
;Save old values in case of error in directory creation
LastMRunDir = MailRunDir
LastMailDir = MailDir
LastReplyDir = ReplyDir
LastDLDir = DownloadDir
LastULDir = UploadDir
settingsbox()
disable CTRL 170
savestatus = 1
while 1
dialogstatus = $DIALOG
switch dialogstatus
case 10
;User selected "Save"
;if the directories chosen in settingsbox()
;don't exist, create them
MakeDirError = 0
MakeDirError = checkdir(MakeDirError, &MailRunDir, LastMRunDir)
MakeDirError = checkdir(MakeDirError, &MailDir, LastMailDir)
MakeDirError = checkdir(MakeDirError, &ReplyDir, LastReplyDir)
MakeDirError = checkdir(MakeDirError, &DownloadDir, LastDLDir)
MakeDirError = checkdir(MakeDirError, &UploadDir, LastULDir)
if MakeDirError == 0
;if all directories exist or were successfully created
;write the settings to MAILRUN.INI
chdir MailRunDir
profilewr MailRunIni "MailRun" "MailRunDir" MailRunDir
profilewr MailRunIni "MailRun" "MailDir" MailDir
profilewr MailRunIni "MailRun" "ReplyDir" ReplyDir
profilewr MailRunIni "MailRun" "DownloadDir" DownloadDir
profilewr MailRunIni "MailRun" "UploadDir" UploadDir
profilewr MailRunIni "MailRun" "DialAttempts" DialAttempts
profilewr MailRunIni "MailRun" "DialTimeout" DialTimeout
profilewr MailRunIni "MailRun" "DialPause" DialPause
profilewr MailRunIni "MailRun" "IdleTimeout" IdleTimeout
profilewr MailRunIni "MailRun" "SavePackets" SavePackets
profilewr MailRunIni "MailRun" "LogRun" LogRun
profilewr MailRunIni "MailRun" "AppendLog" AppendLog
profilewr MailRunIni "MailRun" "AnsiInLog" AnsiInLog
profilewr MailRunIni "MailRun" "NewfileFilter" NewfileFilter
profilewr MailRunIni "MailRun" "Archiver" Archiver
profilewr MailRunIni "MailRun" "QWKReader" QWKReader
profilewr MailRunIni "MailRun" "LogViewer" LogViewer
else
updatedlg 128
loopwhile
endif
savestatus = 0
endcase
case 11
;User selected "Done"
if savestatus == 0
;if settings have been saved, return to processing
exitwhile
endif
if savestatus == 1
;if settings have not been saved, display a warning
sdlgmsgbox "MailRun Message" SaveMsg EXCLAMATION \
OKCANCEL Response 1
switch Response
case 1
;User selected "OK" to continue
loopwhile
endcase
case 2
;User selected "Cancel" to abort
delfile MailRunIni
halt
endcase
endswitch
endif
endcase
case 70
;User selected the "Capture mailrun..." checkbox
if LogRun == 0
disable CTRL 71
disable CTRL 72
else
enable CTRL 71
enable CTRL 72
endif
savestatus = 1
updatedlg 1
endcase
case 230
case 231
case 232
case 233
case 234
case 235
case 236
case 237
case 238
case 239
case 240
case 241
case 242
case 71
case 72
case 73
savestatus = 1
endcase
endswitch
endwhile
endproc


#comment
********************************************************

CHECKDIR()

Called by changesettings()

Creates a directory if all previous directories have been
successfully created. Returns 0 if directory was created;
returns 1 if an error ocurred in creation.

********************************************************
#endcomment

func checkdir : integer
intparm MakeDirError
strparm NewDir, OldDir
if MakeDirError == 0
chdir NewDir
if FAILURE
mkdir NewDir
if FAILURE
usermsg "Unable to create directory %s" NewDir
MakeDirError = 1
NewDir = OldDir
endif
endif
endif
return MakeDirError
endfunc


#comment
********************************************************

UPDATEMRN()

Called by main()

Calls makefullname()

Updates existing *.MRN files to MailRun 2.0 format.

********************************************************
#endcomment

proc updatemrn
string filespec, mrnfile, BBSi, XFerProt, BBS_X
integer i
filespec = makefullname(MailRunDir, "*.MRN")
findfirst filespec
while FOUND
statmsg "Updating Mailrun %s" $FILENAME
mrnfile = makefullname(MailRunDir, $FILENAME)
i = 1
strfmt BBS_X "BBS_%d" i
profilerd mrnfile "MailRun" BBS_X BBSi
while not NULLSTR BBSi
profilewr mrnfile BBSi "BBSType" "PCBoard 14.5"
profilewr mrnfile BBSi "ViewPrompt" "View"
profilerd mrnfile BBSi "XFerProt" XFerProt
profilewr mrnfile BBSi "MailXFerProt" XFerProt
i++
strfmt BBS_X "BBS_%d" i
profilerd mrnfile "MailRun" BBS_X BBSi
endwhile
findnext
endwhile
endproc


#comment
********************************************************

MOVEFILES()

Called by main()

Calls makefullname(), movewas()

Moves MailRun source files to the MailRun directory.

********************************************************
#endcomment

proc movefiles
string aspectpath, temp
temp = makefullname(MailRunDir,"*")
fetch aspect defaultpath aspectpath
addfilename aspectpath "*"
if not strcmpi temp aspectpath
movewas("MRUN200A.WAS")
movewas("MRUN200B.WAS")
movewas("MRUN200C.WAS")
movewas("MRUN200D.WAS")
movewas("MRUN200E.WAS")
movewas("MRUN200F.WAS")
movewas("MRUN200G.WAS")
movewas("MRUN200.H")
movewas("MRUNBKG.BMP")
movewas("MRUNICON.DLL")
statmsg ""
endif
endproc


#comment
********************************************************

MOVEWAS()

Called by movefiles()

Moves a file from its current location to the MailRun
directory.

********************************************************
#endcomment

proc movewas
strparm FileName
string OldFile, NewFile
statmsg "Moving %s" FileName
NewFile = makefullname(MailRunDir, FileName)
fetch aspect defaultpath OldFile
addfilename OldFile FileName
copyfile OldFile NewFile
delfile OldFile
endproc


#comment
********************************************************

GETTEMPDIR()

Called by main()

Assigns the name of the MailRun temporary directory to
TempDir.

********************************************************
#endcomment

proc gettempdir
string env
getenv "TEMP" env
if NULLSTR env
TempDir = $PWTASKPATH
else
TempDir = env
endif
addfilename TempDir "MRUNTEMP"
endproc


#comment
********************************************************

WELCOMEBOX()

Called by makeini()

Displays a dialog box to welcome first time users.

********************************************************
#endcomment

proc welcomebox
HelpPage = 1
dialogbox 80 57 198 125 15 "MailRun" HELPID HelpPage
text 10 11 178 8 center "Welcome to MailRun!"
text 21 26 156 63 center "Before you begin, you will need to \
configure some basic system settings. Default settings for MailRun \
are stored in the file MAILRUN.INI, which may be manually edited.`r`n`r`n\
Press F1 for Help."
pushbutton 49 95 40 14 "OK" normal
pushbutton 104 95 40 14 "Cancel" cancel
enddialog
endproc


#comment
********************************************************

SETTINGSBOX()


Called by changesettings()

Displays the MailRun Settings dialog box.

********************************************************
#endcomment

proc settingsbox
HelpPage = 13
dialogbox 15 36 340 222 15 "MailRun Settings" HELPID HelpPage
groupbox 10 28 200 96 "Directories" shadow
text 16 42 71 8 right "MailRun Directory:"
text 16 58 71 8 right "Mail Directory:"
text 16 74 71 8 right "Reply Directory:"
text 16 90 71 8 right "Download Directory:"
text 16 106 71 8 right "Upload Directory:"
editbox 91 56 110 12 MailDir
editbox 91 72 110 12 ReplyDir
editbox 91 88 110 12 DownloadDir
editbox 91 104 110 12 UploadDir
groupbox 224 28 102 96 "Parameters" shadow
text 234 42 62 8 right "Dial Attempts:"
text 234 58 62 8 right "Dial Timeout:"
text 234 74 62 8 right "Dial Pause:"
text 234 90 62 8 right "Idle Timeout:"
text 234 106 62 8 right "Packets to Save:"
editbox 300 40 16 12 DialAttempts
editbox 300 56 16 12 DialTimeout
editbox 300 72 16 12 DialPause
editbox 300 88 16 12 IdleTimeOut
editbox 300 104 16 12 SavePackets
groupbox 10 132 124 59 "Logging" shadow
checkbox 18 144 112 12 "Capture mailrun to log file" LogRun
checkbox 18 158 112 12 "Append to existing log file" AppendLog
checkbox 18 172 112 12 "Capture ANSI codes in log file" AnsiInLog
checkbox 18 200 134 12 "Filter duplicates from d/l database" NewfileFilter
groupbox 144 132 184 59 "Utilities" shadow
text 145 146 65 8 right "Archive Utility:"
text 145 160 65 8 right "QWK Mail Reader:"
text 145 174 65 8 right "Log File Viewer:"
editbox 214 144 107 12 Archiver
editbox 214 158 107 12 QWKReader
editbox 214 172 107 12 LogViewer
pushbutton 191 200 40 14 "&Save" normal default
pushbutton 252 200 40 14 "&Done" normal
text 100 11 52 8 right "Settings for:"
combobox 156 9 72 42 MailRunList MailRunTrunc sort
editbox 91 40 110 12 MailRunDir
enddialog
endproc


#comment
*************************************************************
*************************************************************

The following are library routines that are also found in
MRUN200.H. They are included here so that MAILRUN.WAS will
compile even though MRUN200.H is not in the ASPECT directory.

*************************************************************
*************************************************************
#comment


#comment
********************************************************

CHECKFILE()

Checks for a file's existence. Returns 1 if the file is
found, 0 if not found.

********************************************************
#endcomment

func checkfile : integer
strparm FileNom
if isfile FileNom
return 1
else
return 0
endif
endfunc


#comment
********************************************************

findstring()

Returns a value of 1 if the second string is contained
in the first string; otherwise returns 0.

********************************************************
#endcomment

func findstring : integer
strparm String1, String2
integer i = 0
if not NULLSTR String2
if strfind String1 String2
i = 1
endif
endif
return i
endfunc


#comment
********************************************************

MAKEFULLNAME()

Appends a filename to a directory name.

********************************************************
#endcomment

func makefullname : string
strparm Directory, FileNamen
string FullName
FullName = Directory
addfilename FullName FileNamen
return FullName
endfunc




  3 Responses to “Category : Communication (modem) tools and utilities
Archive   : MRUN200.ZIP
Filename : MAILRUN.WAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/