Attribute VB_Name = "Module1" ' define the prototype Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As Any, ByVal lsString As Any, ByVal lplFilename As String) As Long Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long ' define the public variable ''Public DeBugging As Boolean ' Flag for Debugging Public RCurDir As String ' App.Path, modified to have unified termination of "\" Public StartTime As Single ' Time at which beeping was started (Program Start Time, or later) Public StartDelay As Single ' Delay before Beeping commences, in seconds Public RecycleDelay As Single ' … Period of Quiet between Recycling Beep sessions Public RecycleBeepDuration As Single ' … Period of BEEPING for Recycling Beep sessions Public DropDead As Single ' Maximum allowed Beep Duration, in seconds Public StartText As String ' Text in Text8.Text box Public DropDeadText As String ' Text in Text10.Text box Public UpDate As Single ' Time of latest check on to beep or not Public IniFileName As String ' Name and Path to .INI file Public CmdLine As String ' Command Line text Public LenCmdLine As Integer ' Length of command Line string Public INI_Edit As String ' Editor for editing INI file Public BeepIntervalSet As Integer ' Timing value between beeps Public BeepIntervalMin As Integer ' Minimum BeepInterval Public BeepIntervalMax As Integer ' Maximum BeepInterval Public Message As String ' Message to be written to screen Public CapTxt As String ' Portion of Message being used in Caption Public BeepOption As String ' Alternative to System Beep Public SavChgM As Boolean ' The message in Text4 area is new, and may be saved Public SavChgA As Boolean ' The data in the Additional Control Area is new, and may be saved if visible Public Cycle As Long ' Counter for cycles through timer routine Public LclTmpI As Integer ' Integer for Local-use only Public LclTmpS As String ' String for Local-use only Public LclTmpSg As Single ' Single for Local-use only Public LclTmpL As Long ' Long for Local-use only Public SizePad As Integer ' Adder to size, when allowing change of Timing Values Public Colon2 As Integer ' Location of second colon in a ReRun: … : message Public ReRunCycles As Single ' Number of half-cycles in ReRun routine Public Arrow As Integer ' Pointer in 'moving-arrow' display when beeping Public Mode As Integer ' 1="Help, and other maintenance"; ' 2="Timing to Alarm"; 3="Beeping"; 4="In Your Face"; ' 5,6,7="ReRun:", Data going in; 8="ReRun:" Counting Down; 9="ReRun:" Beeping; ' 10="Start:" Timing down to Initiate; 11="Start:" Beyond Time/Not Started; 12="Start:" Fail; In your Face ' -x=Just entered mode Public Sub GetCommandLine() ' Get command line arguments, if any are present. (See notes in GetINI) On Error Resume Next ' to cope with data-type error (overflow gives zero = not set) CmdLine = Command() '''' '''' CmdLine = "/ss=99m /ss=14h30 /dd=0s " ' /ss120 /m=Default Message2" '/ss=3600 /m=OOPS!! " '''' For Testing **** '''' '''' CmdLine = "/ss=16h58 /dd=2m /m=Home Time" '''' LenCmdLine = Len(CmdLine) If LenCmdLine > 0 Then ' Look for /?, a request for HELP If InStr(CmdLine, "/?") Then WriteHelp ' Which includes a Message= statement, sending them to read it (and also copes with denial of write-permission). Else ' Look for setting of variables LclTmpI = InStr(1, CmdLine, "/t1=", vbTextCompare) ' Look for /t1= and /T1=. BeepIntervalMin If Not LclTmpI = 0 Then BeepIntervalMin = Val(Right(CmdLine, LenCmdLine - LclTmpI - 3)) LclTmpI = InStr(1, CmdLine, "/t2=", vbTextCompare) ' Look for /t2= and /T2=. BeepIntervalSet (other of two ways to set) If Not LclTmpI = 0 Then BeepIntervalSet = Val(Right(CmdLine, LenCmdLine - LclTmpI - 3)) LclTmpI = InStr(1, CmdLine, "/t3=", vbTextCompare) ' Look for /t3= and /T3=. BeepIntervalMax If Not LclTmpI = 0 Then BeepIntervalMax = Val(Right(CmdLine, LenCmdLine - LclTmpI - 3)) LclTmpI = InStr(1, CmdLine, "/dd=", vbTextCompare) ' Look for /dd=, etc. DropDead setting, which could be ZERO If Not LclTmpI = 0 Then ' Continue above looking for … LclTmpI = LclTmpI + 4 ' Start of code is 4 characters beyond the start of the "/dd=" code lcltmpi2 = InStr(LclTmpI, CmdLine, "/") ' Find the start of the next code If lcltmpi2 = 0 Then lcltmpi2 = Len(CmdLine) + 1 ' If no 'next' code found, then use the lenght of the line DropDeadText = Mid(CmdLine, LclTmpI, lcltmpi2 - LclTmpI) ' Extract the code from the command line End If LclTmpI = InStr(1, CmdLine, "/m=", vbTextCompare) ' Look for /m and /M. Message If Not LclTmpI = 0 Then Message = Right(CmdLine, LenCmdLine - LclTmpI - 2) LclTmpI = InStr(1, CmdLine, "/f=", vbTextCompare) ' Look for /f and /F. INI File [path\]name If Not LclTmpI = 0 Then IniFileName = CStr(Right(CmdLine, LenCmdLine - LclTmpI - 2)) If Mid(IniFileName, 2, 1) = ":" Then ' IniFileName is expressed as Drive:[\path\]File ' No change to IniFileName ElseIf Mid(IniFileName, 1, 1) = "\" Then ' Name is specified to be in root dir, so take as such IniFileName = Left(RCurDir, 2) & IniFileName ' Add the "Drive:" designation Else IniFileName = RCurDir & IniFileName ' Take to be file in current drive End If End If LclTmpI = InStr(1, CmdLine, "/ss=", vbTextCompare) ' Look for /ss= Start Time setting (by deferal, or specific time) If Not LclTmpI = 0 Then ' Continue above looking for … LclTmpI = LclTmpI + 4 ' Start of code is 4 characters beyond the start of the "/dd=" code lcltmpi2 = InStr(LclTmpI, CmdLine, "/") ' Find the start of the next code If lcltmpi2 = 0 Then lcltmpi2 = Len(CmdLine) + 1 ' If no 'next' code found, then use the lenght of the line StartText = Mid(CmdLine, LclTmpI, lcltmpi2 - LclTmpI) ' Extract the code from the command line End If If (BeepIntervalMin * BeepIntervalSet) And (BeepIntervalMin > BeepIntervalSet) Then ' Min * Interval =0=False if either is un-set LclTmpI = BeepIntervalMin ' interchange values BeepIntervalMin = BeepIntervalSet BeepIntervalSet = LclTmpI End If If (BeepIntervalMin * BeepIntervalMax) And (BeepIntervalMin > BeepIntervalMax) Then LclTmpI = BeepIntervalMin BeepIntervalMin = BeepIntervalMax BeepIntervalMax = LclTmpI End If If (BeepIntervalSet * BeepIntervalMax) And (BeepIntervalSet > BeepIntervalMax) Then LclTmpI = BeepIntervalSet BeepIntervalSet = BeepIntervalMax BeepIntervalMax = LclTmpI End If End If End If End Sub Public Sub GetINI() Dim ret As Long Dim temp As String * 255 'get INI editor, or set it to default ret = GetPrivateProfileString("User-Data", "INI_Edit", "NotePad", temp, 255, IniFileName) INI_Edit = Left(temp, ret) ' Statement may be required to satisfy implication of Length in dimension statement Form1.CmdEditINI.ToolTipText = "Edit "".INI & HELP"" file using " & INI_Edit & "." '' Open IniFileName For Input As 1 ' To create an error, if there is no ini file '' Close 1 ''On Error GoTo EndSub ' Corrupt .INI is handled in the routine. 'get INI Version ret = GetPrivateProfileString("Program-Data", "Version", "0", temp, 255, IniFileName) R1 = Val(temp) R2 = App.Major & "." & App.Minor If Not Val(temp) = App.Major & "." & App.Minor Then ' INI is missing, or an incorrect version If Len(Dir(IniFileName)) > 0 Then ' there is an INI file Message = "You seem to have upgraded your program, but not the .INI file. Please extract irreplaceable information from the existing file " & IniFileName & ", and perform an .INI re-build. This latter step is most easily done by reducing this message to the two characters «/?»." Mode = 0 ' No beeping ' else there is no INI file. Continue, and use default settings. Tool Tips will suffice for "/?" advice ' If LenCmdLine = 0 Then ' There was neither command-line, nor INI file. ' Message = "For help on using this program, reduce this message to the two characters «/?». Help includes information on Command-Line parameters and .INI file settings." End If End If 'get BEEP option ret = GetPrivateProfileString("User-Data", "BEEP", "Beep", temp, 255, IniFileName) BeepOption = Left(temp, ret) ' Statement may be required to satisfy implication of Length in dimension statement 'get Message, if not already set by Command-Line parameter If Message = "" Then ret = GetPrivateProfileString("User-Data", "Message", "Default Message", temp, 255, IniFileName) Message = temp ' Statement may be required to satisfy implication of Length in dimension statement End If 'get BeepIntervalSet, if not already set If BeepIntervalSet = 0 Then ret = GetPrivateProfileString("User-Data", "BeepIntervalSet", "0", temp, 255, IniFileName) BeepIntervalSet = Int(Val(temp)) End If 'get BeepIntervalMin, if not already set If BeepIntervalMin = 0 Then ret = GetPrivateProfileString("User-Data", "BeepIntervalMin", "0", temp, 255, IniFileName) BeepIntervalMin = Int(Val(temp)) End If 'get BeepIntervalMax, if not already set If BeepIntervalMax = 0 Then ret = GetPrivateProfileString("User-Data", "BeepIntervalMax", "0", temp, 255, IniFileName) BeepIntervalMax = Int(Val(temp)) End If 'get DropDead, if not already set If DropDeadText = "" Then ' DropDead was not set on Command Line ret = GetPrivateProfileString("User-Data", "DropDead", "0", temp, 255, IniFileName) DropDeadText = Left(temp, ret) End If ' Get StartSet, if not already set If StartText = "" Then ret = GetPrivateProfileString("User-Data", "StartSet", "0", temp, 255, IniFileName) StartText = Left(temp, ret) End If End Sub Public Sub WriteINI() On Error Resume Next Dim ret As Long ret = WritePrivateProfileString("User-Data", "Message", Message, IniFileName) ' Write the present message If ret = 0 Then Message = "ERROR! Message not saved! Check for valid write permission. « " & Message & " »" ' The message is prefixed with the error message Beep ' Draw their attention to the error End If If SizePad > 0 Then ' If the Additional Control Area is open: Write the additional data ' Write BeepInterval settings ret = WritePrivateProfileString("User-Data", "BeepIntervalMax", CStr(BeepIntervalMax), IniFileName) ret = WritePrivateProfileString("User-Data", "BeepIntervalSet", CStr(BeepIntervalSet), IniFileName) ret = WritePrivateProfileString("User-Data", "BeepIntervalMin", CStr(BeepIntervalMin), IniFileName) If StartDelay > 0 Then ' Delay setting is to be written ret = WritePrivateProfileString("User-Data", "StartSet", StartText, IniFileName) End If If DropDead > 0 Then ' Delay setting is to be written ret = WritePrivateProfileString("User-Data", "DropDead", DropDeadText, IniFileName) End If End If End Sub Public Function RValue(text As String) As Single ' Convert a text string from digits and literals (s,m,h,d) to a non-negative number of seconds Dim Found(6) As Long ' Used in RValue function Found(0) = 0 ' set to zero, as not found yet Found(1) = Len(text) + 1 ' Prime at length of string +1. Then change to occurance of earliest of the following letters: Found(2) = InStr(2, text, "s", vbTextCompare) ' Find earliest location of s (zero if not found) Found(3) = InStr(2, text, "m", vbTextCompare) Found(4) = InStr(2, text, "h", vbTextCompare) Found(5) = InStr(2, text, "d", vbTextCompare) Found(6) = InStr(2, text, "w", vbTextCompare) For i = 2 To 6 If (Found(i) > 0) And (Found(i) < Found(1)) Then ' If this is a smaller, non-zero value Found(1) = Found(i) ' Save it as the smallest seen yet Found(0) = i ' Save where it was found End If Next i If Found(0) = 2 Then Found(0) = 1 ' Conversion to seconds ElseIf Found(0) = 3 Then Found(0) = 60 ' Conversion is to minutes ElseIf Found(0) = 4 Then Found(0) = 3600 ' Conversion is to hours ElseIf Found(0) = 5 Then Found(0) = 86400 ' Conversion is to days ElseIf Found(0) = 6 Then Found(0) = 604800 ' Conversion is to weeks End If On Error GoTo OverFlow LclTmpSg = Val(text) If LclTmpSg < 0 Then LclTmpSg = -LclTmpSg ' Convert negative to positive RValue = LclTmpSg * Found(0) ' Convert to seconds - zero if no units Exit Function OverFlow: RValue = 0 End Function Public Sub WriteHelp() ' If execution is here, the INI file is missing or corrupt, or requested. A re-build is called for. 'ReWrite the .INI file, if allowed '' BeepIntervalSet = 999 ' Set beep-interval to max (BIMax will follow suit) If INI_Edit = "" Then INI_Edit = "NotePad" ' Set to default, if nothing else is set On Error GoTo NoWrite Dim f Set f = CreateObject("Scripting.FileSystemObject").CreateTextFile(RCurDir & "Reminder_RwcS.ini", 2, TristateFalse) LclTmpS = "[User-Data]" f.WriteLine (LclTmpS) LclTmpS = "Message = Default Message" f.WriteLine (LclTmpS) LclTmpS = "BeepIntervalMax = 32" f.WriteLine (LclTmpS) LclTmpS = "BeepIntervalSet = 20" f.WriteLine (LclTmpS) LclTmpS = "BeepIntervalMin = 1" f.WriteLine (LclTmpS) LclTmpS = "DropDead = 0.05h" f.WriteLine (LclTmpS) LclTmpS = "StartSet = 3 min" f.WriteLine (LclTmpS) LclTmpS = "INI_Edit = NotePad" f.WriteLine (LclTmpS) LclTmpS = "BEEP = Beep" f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "[Program-Data]" f.WriteLine (LclTmpS) LclTmpS = "Version = 1.21" f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "[HELP] HELP HELP HELP HELP HELP HELP HELP" f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = " This program is designed, on being started, to beep and display a message. After that, it will wait a period of time, and then commence regular beeping. If beeping proves unable to garner attention, a second, «In Your Face obnoxious», stage is entered. The message, the wait periods, and the beep rate are settable (by command-line parameters and/or .INI file information), and are adjustable at Run-Time." f.WriteLine (LclTmpS) LclTmpS = " • Editing the message serves to acknowledge the alarm." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = " There are three classes of 'Special Message' which access additional functions." f.WriteLine (LclTmpS) LclTmpS = " • The 'Special Message' «/?» will re-build this combination HELP and .INI file." f.WriteLine (LclTmpS) LclTmpS = " o Note that this message is two characters long, containing neither spaces nor line-feed characters." f.WriteLine (LclTmpS) LclTmpS = " • 'Special Messages' beginning «Start:» will have the program try, when the timer passes zero, to launch the [[Drive:\]Path\]Executable[.Extension] identified in the text following «Start:»" f.WriteLine (LclTmpS) LclTmpS = " o The Message Area will be green to indicate this task is pending. Reminder_RwcS will close, if the program launches. Otherwise, the Message Area will turn red, and beeping will commence." f.WriteLine (LclTmpS) LclTmpS = " o The item to be launched must be an executable. (Referencing a file that has an extension to which a program is associated is not good enough.) Long-file-name (and directory-name) format is acceptable, as are short file-names. Do not use quotation marks, even if a long file name includes spaces." f.WriteLine (LclTmpS) LclTmpS = " o Command-line parameters may follow the command name." f.WriteLine (LclTmpS) LclTmpS = " • Another class of 'Special Message' consists of ones beginning «ReRun:», and containing «Off=##» and «On=##», where ## are numbers with associated unit. Entering a valid message will turn the Message Area yellow. After the passage of the Off-Time, the Message Area will turn orange and beeping will commence for the On-Time. After the On-Time, the Message Area will revert to yellow and the cycle will repeat ad nauseam. Cycles will be counted at the lower left corner of the Message Area." f.WriteLine (LclTmpS) LclTmpS = " o Individual time-unit designators may be placed after each number or, a common unit may be placed after the second number. Supported units are Seconds, Minutes, Hours, Days and Weeks." f.WriteLine (LclTmpS) LclTmpS = " o Counter performance becomes inaccurate somewhere beyond the first trillion cycles." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = " The vertical scrollbar adjusts the beeping frequency. Beside the base of the scrollbar is a box showing the setting of the bar. The default is 20, in a suggested range of 1 to 32." f.WriteLine (LclTmpS) LclTmpS = " The next box over is a counter, which may be seen to increase from 0.1 to the value of the scrollbar. On reaching the scrollbar value, it will reset to 0.1. Since the counting rate, as well as the maximum count, is dependent on the scrollbar setting, the adjustment is roughly logarithmic." f.WriteLine (LclTmpS) LclTmpS = " Another box at the bottom shows. in black on green, how soon beeping is to commence -- or, in white on red, the total time elapsed since beeping commenced. This value is updated with each zero-crossing of the counter. Beeping occurs when this data is updated." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "Data and Limits" f.WriteLine (LclTmpS) LclTmpS = " «Message» is the message that is displayed." f.WriteLine (LclTmpS) LclTmpS = " • A message on the order of 1000 characters, or longer, may not be properly saved. A message longer than about a quarter-million characters, if saved, may corrupt the .INI file." f.WriteLine (LclTmpS) LclTmpS = " «BeepIntervalSet» is an integer that governs the beep interval. It must be in the range of «BeepIntervalMin» to «BeepIntervalMax»." f.WriteLine (LclTmpS) LclTmpS = " «BeepIntervalMax» is an integer that governs the maximum setting for «BeepIntervalSet». It must be 999, or lower." f.WriteLine (LclTmpS) LclTmpS = " «BeepIntervalMin» is an integer that governs the minimum setting for «BeepIntervalSet». It must be 1, or higher." f.WriteLine (LclTmpS) LclTmpS = " «StartSet» governs the delay to onset of alarm. It may be specified as a value, complete with units, or may be specified as a time in the format of ##h## or ##h##m. The commencement of beeping will be delayed by the specified duration, or will be delayed until the specified time." f.WriteLine (LclTmpS) LclTmpS = " • Time values may be specified as Seconds (or seconds, Second, second, Secs., secs, S, s., etc); Min, etc.; Hr; Days; or Wks." f.WriteLine (LclTmpS) LclTmpS = " • The hour marker character for a 'Start At' time must be lower-case, not «H»." f.WriteLine (LclTmpS) LclTmpS = " • Adjusting the system clock can generate a 1-day inaccuracy in the following circumstances:" f.WriteLine (LclTmpS) LclTmpS = " o Backwards, crossing midnight." f.WriteLine (LclTmpS) LclTmpS = " o Backwards, before the first update of the day (which may include a regular time-lune change where the update interval is infrequent)." f.WriteLine (LclTmpS) LclTmpS = " o Forwards, crossing midnight, to a time beyond 02h00" f.WriteLine (LclTmpS) LclTmpS = " • Durations of 2^128 seconds (a very long time), and longer, are disallowed." f.WriteLine (LclTmpS) LclTmpS = " • Decimal fractions are supported, as is base-ten exponentiation (e.g.2E6s = 2,000,000 seconds, approximately 6.6 Weeks)." f.WriteLine (LclTmpS) LclTmpS = " «DropDead» is a time value governing the duration of the first stage of alarm." f.WriteLine (LclTmpS) LclTmpS = " • This function may be defeated by setting it to zero." f.WriteLine (LclTmpS) LclTmpS = " «INI_Edit» specifies the [[Drive:\]Path\]Editor to use for editing the .INI file." f.WriteLine (LclTmpS) LclTmpS = " «BEEP» has a default value of «Beep», which calls the system beep. It may, however be set to [[Drive:\]Path\]Executable [Command-Line Parameters] to generate some other output." f.WriteLine (LclTmpS) LclTmpS = " Illegal data received on start-up can result in default values being used." f.WriteLine (LclTmpS) LclTmpS = " Illegal entries will be highlighted in red." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "Controls" f.WriteLine (LclTmpS) LclTmpS = " The 'Save New Settings' button will re-write the Message portion of the .INI file with the current text in the Message Area. Any line-break characters will be converted to spaces before writing. If the Additional Control Area (discussed below) is open, more information is written: The Slider Values (Minimum, Maximum, Setting) will be written; If Alarm Mode is pending, StartSet will be written; If DropDead is implemented, it will be written." f.WriteLine (LclTmpS) LclTmpS = " • This option may not be available if there are no changes to be written." f.WriteLine (LclTmpS) LclTmpS = " • If write-permission is denied, a message advises of the problem, and the message to have been saved is preserved." f.WriteLine (LclTmpS) LclTmpS = " Above the slider is a button to open the Additional Control Area, wherein the slider settings may be altered digitally. The same button closes the Additional Control Area. With this area open, (as previously noted) the 'Save New Settings' button will also write these current values to the .INI file." f.WriteLine (LclTmpS) LclTmpS = " With the Additional Control Area open, one may also access a button labelled «Help». This will try to edit the current .INI file, using NotePad, or whatever [[Drive:\]Path\]Editor is noted at the «INI_Edit» option in the .INI file." f.WriteLine (LclTmpS) LclTmpS = " • Yes, this can be a catch-22 situation." f.WriteLine (LclTmpS) LclTmpS = " • If there is no .INI file to be edited -- which can happen if the program is started with command-line parameters -- it may be built in the appropriate directory by using the Special Message «/?»." f.WriteLine (LclTmpS) LclTmpS = " • Settings changed by editing the .INI file have no effect on copies of the program currently running." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = " There are four possible sources for the settings of this program: Default; .INI file; Command Line Parameters; Run-Time changes." f.WriteLine (LclTmpS) LclTmpS = " • Program Internal Default Settings are immutable by the user." f.WriteLine (LclTmpS) LclTmpS = " • Valid settings imported from the .INI file, will over-ride Program Default Settings." f.WriteLine (LclTmpS) LclTmpS = " • Valid Command-Line Parameters, will over-ride .INI file information." f.WriteLine (LclTmpS) LclTmpS = " • Changes may also be made at Run-Time." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "Options for the .INI File:" f.WriteLine (LclTmpS) LclTmpS = " If you wish, you may delete the «[HELP] . . .» section of this file. You may also make changes and annotations to it. The «[User-Data]» and «[Program-Data]» sections must stay if .INI information is to be used, as must the identifier for any parameter being used. Data after the equals sign in each line of the «[User-Data]» section may be altered. The data in the «[Program-Data]» section should not be altered. Between the section headers of «[User-Data]» and «[Program-Data]», items may be shuffled." f.WriteLine (LclTmpS) LclTmpS = " The text following the equals sign on any line in the «[User-Data]» section may be altered." f.WriteLine (LclTmpS) LclTmpS = " • Invalid data will be laundered out." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "Options for the Command Line:" f.WriteLine (LclTmpS) LclTmpS = " Command Line arguments may be used to control the program behaviour (message, timing, .INI [[Drive:\]Path\]]Name). Parameters not available from the Command Line are sought in the .INI file (of default name, if none was specified). Parameters not available there either, are set to default." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "Allowable Command Line Arguments are:" f.WriteLine (LclTmpS) LclTmpS = " [/?]" f.WriteLine (LclTmpS) LclTmpS = " [/t1=BeepIntervalMin] [/t2=BeepIntervalSet] [/t3=BeepIntervalMax] [/ss=StartSet] [/dd=DropDead] and [[/m=Message] or [/f=File]]" f.WriteLine (LclTmpS) LclTmpS = " • /? Regenerates this combination HELP and .INI file, and prefixes the displayed message with information as to whither the file was written. This process destroys any existing message saved on disc, but by doing a «Save New Settings» one may then restore the message. (If write-permission is denied -- suggestions are made on how to proceed.)" f.WriteLine (LclTmpS) LclTmpS = " • BeepIntervalMin, BeepIntervalSet, and BeepIntervalMax, StartSet, DropDead, and Message, are as discussed above in 'Data and Limits'." f.WriteLine (LclTmpS) LclTmpS = " • 'File' is the [[Drive:\]Path\]File to substitute for the default .INI. Its specification may include spaces (as allowed by the long file-name format), and therefore must be placed last in the string." f.WriteLine (LclTmpS) LclTmpS = " • Note that, since 'Message' may include spaces, it too must be placed last in the string." f.WriteLine (LclTmpS) LclTmpS = " o If both /M= and /F= are specified, and if /M= precedes /F=, then the exception is well handled, although the .INI file location string is appended to the message. If /F= precedes /M=, then the .INI will not be found, as it is being looked for complete with the «/M=. . .» text as part of the Path\Filename." f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = "Options at Run-Time:" f.WriteLine (LclTmpS) LclTmpS = " Illegal entries in the Additional Control Area will be highlighted in red. By closing and re-opening the area or double-clicking on an error, one may repair the error." f.WriteLine (LclTmpS) LclTmpS = " • Slider values return to their latest acceptable values. StartSet and DropDead, if in error, are set to 0Min." f.WriteLine (LclTmpS) '' LclTmpS = "" '' f.WriteLine (LclTmpS) '' LclTmpS = "Anomalies:" '' f.WriteLine (LclTmpS) '' LclTmpS = " None Known." '** There are no know bugs, at this time. '' f.WriteLine (LclTmpS) LclTmpS = "" f.WriteLine (LclTmpS) LclTmpS = " The latest version of this program should be available for download from «http://www.wendygamble.com/RwcS/Programs/Reminder/». Bugs and ideas for Upgrade may be submitted to «robert@wendygamble.com»." f.WriteLine (LclTmpS) f.Close ' WriteINI ' This option is considered -- several times. Last thought was 'no' 'Display a default message Message = "The help you requested is available in the text file: «" & RCurDir & "Reminder_RwcS.ini»." Mode = 0 ' No beeping On Error Resume Next ' Reset to default Exit Sub NoWrite: ' If execution is here, the INI-Rebuild was not possible. ' Display a default message Message = "You requested help, but the '.INI' re-build was not allowed. Please run the program in a new directory to which the file: «Reminder_RwcS.ini» (~12 K) may be added." Mode = 0 ' No beeping On Error Resume Next ' Reset to default End Sub ''Public Function modulo(number As Single, base As Integer) As Single ' Convert a number to modulo of base ''If base = 0 Then '' modulo = 0 ' This may or not be an official definition '' Exit Function ''End If ''number = number - Int(number / base) * base ' Make a first-cut reduction ''For i = 1 To 5 ' limit the number of iterations in the final homing-in (this may be necessary where number precision complicates things) '' If number >= base Then '' number = number - base '' ElseIf number < 0 Then '' number = number + base '' Else '' modulo = number '' Exit Function '' End If ''Next i '''' if exectution reaches here, the function failed '''' ** enter error handling code here ** ''End Function