home *** CD-ROM | disk | FTP | other *** search
/ .net 1999 December / netCD65.iso / pc / Software / VirtualA / 16bit / vaper16.exe / %MAINDIR% / Lib.ebs < prev    next >
Encoding:
Text File  |  1999-10-06  |  18.9 KB  |  658 lines

  1. 'T:LIBS.EBS (global)
  2. ' VA 4.10
  3.  
  4. 'Add file to import queue 16 bit and 32 bit declares
  5. Declare Function AddToDoList16 Pascal Lib "addons.dll" Alias "AddToDoList" (ByVal szService As String, ByVal szFileName As String, ByVal szMailname As String, ByVal iFlags As Long) As Integer
  6. Declare Function AddToDoList32 Pascal Lib "addons32.dll" Alias "AddToDoList" (ByVal szService As String, ByVal szFileName As String, ByVal szMailname As String, ByVal iFlags As Long) As Long
  7.  
  8. 'T:iFlags Global (constants) 
  9. Const IM_DELETE = 2048        ' Delete scratchpad file afterwards?
  10.  
  11. Const fRECEIPT = 1            ' CIS mail receipt
  12. Const fPRIVATE = 2            ' CIS private forum message
  13. Const fNOFORMAT = 4           ' CIS unformatted message
  14.  
  15. Const BlockSize = 4096
  16.  
  17. Dim uniquefno As Long
  18. Dim workpath As String
  19. Dim RepFilename As String
  20.  
  21. 'T:MakeFilename (subroutine) (global)
  22. ' This takes a directory and filename and returns the full path to the file
  23. ' adding a backslash between them if necessary
  24. Function MakeFilename(directory As String, fname As String) As String
  25.     If Right$(directory, 1) <> "\" Then 
  26.         MakeFilename = directory & "\" & fname
  27.     Else
  28.         MakeFilename = directory & fname
  29.     End If
  30. End Function
  31.  
  32. 'T:SendCR (subroutine) (global)
  33. 'Typical tracker procedure, such as might be used to reply to a "More" prompt
  34. 'Sends a carriage return to the service, and removes the prompt from the capture file
  35. Sub SendCR(t As Tracker)
  36.     Print "Matched:"; t.name; ":Sending <cr>"
  37.     Comms.Send "\r"
  38.     CaptureRewind len(t.Match)
  39.     t.reset
  40. End Sub
  41.  
  42. 'T:SendNo (subroutine) (global)
  43. 'Typical tracker procedure, such as might be used to reply to a "Y/N" prompt
  44. 'Sends an "n" to the service, and removes the prompt from the capture file
  45. Sub SendNo(t As Tracker)
  46.     Print "Matched:"; t.name; ":Sending n<cr>"
  47.     Comms.Send "n\r"
  48.     CaptureRewind len(t.Match)
  49.     t.reset
  50. End Sub
  51.  
  52. 'T:SendYes (subroutine) (global)
  53. 'Typical tracker procedure, such as might be used to reply to a "More" prompt
  54. 'Sends a "y" to the service, and removes the prompt from the capture file
  55. Sub SendYes(t As Tracker)
  56.     Print "Matched:"; t.name; ":Sending y<cr>"
  57.     Comms.Send "y\r"
  58.     CaptureRewind len(t.Match)
  59.     t.reset
  60. End Sub
  61.  
  62. 'T:ParseString (function) (global)
  63. 'Useful library routine to parse a string into individual arguments
  64. 'Each call returns the first argument, and removes it from the string
  65. Function ParseString(args As String, delim As String) As String
  66.     Dim p As integer
  67.  
  68.     p = Instr(args, delim)
  69.     If p Then
  70.         ParseString = Left$(args, p - 1)
  71.         args = Mid$(args, p + Len(delim))
  72.     Else
  73.         ParseString = args
  74.         args = ""
  75.     End If
  76. End Function
  77.  
  78. 'T:DeleteFile (subroutine) (global)
  79. 'Routine to delete a file without giving a Basic error
  80. 'if the file doesn't exist
  81. Sub DeleteFile(filename As String)
  82.     On Error Resume Next
  83.     Kill filename
  84.     On Error Goto 0
  85. End Sub
  86.  
  87. 'T:WaitForTimed (subroutine) (global)
  88. 'Useful routing to wait for a string
  89. 'If any existing tracks are hit, any tracker procedures are called,
  90. 'but trackers without procedures are ignored and reset
  91. 'If the string we wanted doesn't arrive, the Basic error will NOT be trapped
  92. Sub WaitForTimed(s As String, timeout As Integer)
  93.     Dim t As Tracker, t1 As Tracker
  94.  
  95.     Print "WaitForTimed "; s; timeout
  96.     Trackers.Reset
  97.     Set t = CreateTracker("WaitFor", s, "", True)
  98.     Do
  99.         Set t1 = Wait(timeout)
  100.         t1.reset
  101.     Loop Until t1 = t
  102.     t.delete
  103. End Sub
  104.  
  105. 'T:WaitForWithTimeout (function) (global)
  106. 'Useful routine to wait for a string
  107. 'If any existing tracks are hit, any tracker procedure are called,
  108. 'but trackers without procedures are ignored and reset
  109. 'If the string wanted doesn't arrive, then returns False
  110. Function WaitForWithTimeout(s As String, timeout As Integer)
  111.     On Error Goto WaitForWithTimeout_error
  112.     WaitForTimed s, timeout
  113.     WaitForWithTimeout = True
  114.     Print "OK"
  115.     Exit Function
  116. WaitForWithTimeout_error:
  117.     Print "Failed"
  118.     If Err = 1002 Then WaitForWithTimeout = False
  119.     Exit Function
  120. End Function
  121.  
  122. 'T:WaitFor (subroutine) (global) (global)
  123. 'Useful routing to wait for a string for 30 seconds
  124. Sub WaitFor(s As String)
  125.     WaitForTimed s, 300
  126. End Sub
  127.  
  128. 'T:WaitForEitherTimed (subroutine) (global)
  129. 'Useful routing to wait for 2 different strings
  130. 'If any existing tracks are hit, any tracker procedures are called,
  131. 'but trackers without procedures are ignored and reset
  132. 'If the string we wanted doesn't arrive, the Basic error will NOT be trapped
  133. Function WaitForEitherTimed(s1 As String, s2 As String, timeout As Integer) As String
  134.     Dim t As Tracker, t1 As Tracker, t2 As Tracker
  135.  
  136.     Print "WaitForEitherTimed "; s1; s2; timeout
  137.     Trackers.Reset
  138.     Set t1 = CreateTracker("WaitFor1", s1)
  139.     Set t2 = CreateTracker("WaitFor2", s2)
  140.     Do
  141.         Set t = Wait(timeout)
  142.         t.reset
  143.     Loop Until t1 = t Or t2 = t
  144.     If t1=t Then
  145.         WaitForEitherTimed = s1
  146.     Else
  147.         WaitForEitherTimed = s2
  148.     End If
  149.     t1.delete
  150.     t2.delete
  151. End Function
  152.  
  153. 'T:WaitWithKick (function) (global)
  154. 'Useful routine to wait for a string for 30 seconds, and prod the service
  155. 'with another string if it doesn't arrive
  156. Function WaitWithKick(s As String, kick As String)
  157.     Print "WaitWithKick "; s
  158.     On Error Goto WaitWithKick_error
  159.     WaitFor s
  160.     WaitWithKick = True
  161.     Print "OK"
  162.     Exit Function
  163. WaitWithKick_error:
  164.     Print "Failed"
  165.     If Err = 1002 Then Comms.Send kick
  166.     WaitWithKick = False
  167.     Exit Function
  168. End Function
  169.  
  170. 'T:RepeatWaitWithKick (function) (global)
  171. 'Repeatedly calls WaitWithKick until we get a result
  172. Function RepeatWaitWithKick(s As String, kick As String, count As Integer)
  173.     Do
  174.         If WaitWithKick(s, kick) Then
  175.             RepeatWaitWithKick = True
  176.             Exit Function
  177.         End If
  178.     count = count - 1
  179.     Loop While count > 0
  180.     RepeatWithKick = False
  181. End Function
  182.  
  183. 'T:SplitPath (subroutine) (global)
  184. 'Useful routines to split a path up into its components
  185. Sub SplitPath(fullpath As String, pathonly As String, fileonly As String)
  186.     Dim p As Integer, lastp As Integer
  187.  
  188.     lastp = 1
  189.     If Len(fullpath) > 2 Then
  190.         If Mid$(fullpath, 2, 1) = ":" Then
  191.             lastp = 3
  192.         End If
  193.     End If
  194.     Do
  195.         p = Instr(lastp, fullpath, "\")
  196.         If p = 0 Then p = Instr(lastp, fullpath, "/")
  197.         if p Then lastp = p + 1
  198.     Loop While p
  199.     pathonly = Left$(fullpath, lastp - 1)
  200.     fileonly = Mid$(fullpath, lastp)
  201. End Sub
  202.  
  203. 'T:FileName$ (function) (global)
  204. Function FileName$(fullpath As String)
  205.     Dim pathonly As String, fileonly As String
  206.     SplitPath fullpath, pathonly, fileonly
  207.     FileName = fileonly
  208. End Function
  209.  
  210. 'T:MakePath (function) (global)
  211. Function MakePath$(directory As String, file As String)
  212.     Dim path As String
  213.  
  214.     If directory > "" Then
  215.         Select Case Right$(path, 1)
  216.             Case ":", "\", "/"
  217.                 path = directory
  218.             Case Else
  219.                 path = directory + "\"
  220.         End Select
  221.     End If
  222.     MakePath = path + file
  223. End Function
  224.  
  225. 'T:UniqueFileName (function) (global)
  226. 'Generate a unique download filename
  227. Function UniqueFileName$()
  228.     Dim fname As String
  229.  
  230.     ' Make sure we have a workpath
  231.     If workpath="" Then
  232.         workpath = ReadIni$("Service "+Session.Service, "Work Path", Session.IniFileName)
  233.         If workpath="" Then
  234.             workpath = ReadIni$("Main", "Message Path", Session.IniFileName)
  235.             workpath = MakeFilename(workpath, "temp")
  236.             On Error Resume Next
  237.             MkDir workpath
  238.             WriteIni "Service "+Session.Service, "Work Path", MakeFilename(workpath, ""), Session.IniFileName
  239.         End If
  240.     End If
  241.  
  242.     On Error Goto UniqueFileName_gotname
  243.     Do
  244.         uniquefno = uniquefno + 1
  245.         fname = MakeFilename(workpath, "msw" + right$(str$(100000+uniquefno), 5) + ".tmp")
  246.         Open fname For Input Access Read Shared As #1
  247.         Close #1
  248.     Loop
  249. UniqueFileName_gotname:
  250.     On Error Goto 0
  251.     UniqueFileName$ = fname
  252.     Exit Function
  253. End Function
  254.  
  255. 'T:ManualTerminal (subroutine) (global)
  256. 'Manual Terminal
  257. Sub ManualTerminal
  258.     Dim t As Tracker
  259.  
  260.     On Error Goto ManualTerminal_error
  261.     LogResult "Manual terminal mode"
  262.     Trackers.delete
  263.     Do
  264.         Print "W";
  265.         Set t = Wait(0)
  266.         Print "R";
  267.     Loop
  268.     Exit Sub
  269. ManualTerminal_error:
  270.     Print
  271.     Print "Terminal Err"; Err; ":"; Erl; ":"; Error$
  272.     If Err = 1002 Or Err = 1003 Or Err = 1004 Then Resume 0
  273.     Print "Terminal - exiting"
  274.     Exit Sub
  275. End Sub
  276.  
  277. 'T:DialService (function) (global)
  278. 'Dial the numbers in the ashmount.ini file until connected
  279. Function DialService()
  280.     Print "DialService"
  281.     Redials% = Val(ReadIni$(Session.IniSection, "Retries", Session.IniFileName))
  282.     If Redials% <= 0 Then Redials% = 1
  283.     For i% = 1 to Redials%
  284.         NumberList$ = ReadIni$(Session.IniSection, "Phone", Session.IniFileName)
  285.         If NumberList$ = "" Then Goto DialService_nonumber
  286.         Do
  287.             number$ = ParseString(NumberList, ";")
  288.             If Comms.Dial(number$) Then
  289. DialService_nonumber:
  290.                 Terminal.RestartTimer
  291.                 If Session.LoginScript <> "" Then
  292.                     Terminal.Status "Logging in - " + Session.LoginScript
  293.                     If Login() Then
  294.                         DialService = True
  295.                         Terminal.Status "Connected to " + Session.Service
  296.                         Exit Function
  297.                     End If
  298.                 Else
  299.                     DialService = True
  300.                     Exit Function
  301.                 End If
  302.             Else
  303.                 If Err = 1006 Then Exit Do
  304.             End If
  305.             Comms.Hangup
  306.         Loop While NumberList$ <> ""
  307.     Next
  308.     DialService = False
  309. End Function
  310.  
  311. 'T:OpenRepFile (subroutine) (internal)
  312. 'Opens the LogResult report file
  313. Sub OpenRepFile
  314.     If RepFilename = "" Then StartReportFile
  315.     Open RepFilename For Append Access Read Write Shared As #10
  316. End Sub
  317.  
  318. 'T:LogResult (subroutine) (global)
  319. 'Routines to report success or failure of a command
  320. Sub LogResult(result As String)
  321.     Print result
  322.     Terminal.Status result
  323.     OpenRepFile
  324.     Print #10, result
  325.     Close #10
  326. End Sub
  327.  
  328. 'T:ReportSuccess (subroutine) (global)
  329. Sub ReportSuccess(id As String)
  330.     LogResult id + " : Succeeded"
  331.     Open Session.ServicePath + "success.log" For Append Access Read Write Shared As #10
  332.     Print #10, id
  333.     Close #10
  334. End Sub
  335.  
  336. 'T:ReportFailure (subroutine) (global)
  337. Sub ReportFailure(id As String, reason As String)
  338.     LogResult id + " : Failed : " + reason
  339. End Sub
  340.  
  341. 'T:StartReportFile (subroutine) (global)
  342. Sub StartReportFile
  343.     RepFilename = MakeFilename(ReadIni$("Main", "Message Path", Session.IniFileName), Session.Service+".rep")
  344.     Open RepFilename For Append Access Read Write Shared As #10
  345.     Print #10, "!end" ' Just in case something was already there
  346.     Print #10, "!start actions/information Terminal"
  347.     Close #10
  348. End Sub
  349.  
  350. 'T:EndReportFile (subroutine) (global)
  351. Sub EndReportFile
  352.     Dim result As Integer, resultl As Long
  353.  
  354.     OpenRepFile
  355.     Print #10, "!end"
  356.     Close #10
  357.  
  358.     ' Don't add to the import queue - since VA32.EXE does this
  359. End Sub
  360.  
  361. 'T:NoSpaces (function) (global)
  362. ' Converts "PC Week News" -> "PC_Week_News"
  363. Function NoSpaces(s As String) As String
  364.     Dim tmp As String
  365.  
  366.     tmp = ""
  367.     For i = 1 To Len(s)
  368.         If Mid(s, i, 1)=" " Then
  369.             tmp = tmp + "_"
  370.         Else
  371.             tmp = tmp + Mid(s, i, 1)
  372.         End If
  373.     Next
  374.  
  375.     NoSpaces = tmp
  376. End Function
  377.  
  378. 'T:ToSpaces (function) (global)
  379. ' Converts "PC_Week_News" -> "PC Week News"
  380. Function ToSpaces(s As String) As String
  381.     Dim tmp As String
  382.  
  383.     tmp = ""
  384.     For i = 1 To Len(s)
  385.         If Mid(s, i, 1)="_" Then
  386.             tmp = tmp + " "
  387.         Else
  388.             tmp = tmp + Mid(s, i, 1)
  389.         End If
  390.     Next
  391.  
  392.     ToSpaces = tmp
  393. End Function
  394.  
  395. 'T:Pause (subroutine) (global)
  396. Sub Pause(secs As Integer)
  397.     ' should delay for a bit
  398.     Dim fin As Single
  399.  
  400.     fin = Timer()+secs
  401.     Do
  402.         DoEvents
  403.     Loop Until Timer()>=fin
  404. End Sub
  405.  
  406. 'T:QueueFile (function) (Global)
  407. 'Queue a file for adding to the message base
  408. Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean
  409.     Dim fname As String
  410.     Dim result As Integer, resultl As Long
  411.  
  412.     On Error Goto QueueFile_error
  413.     If Filelen(sfilename) = 0 Then
  414.         Print "File:"; sfilename; " is empty"
  415.         LogResult "File was empty"
  416.         DeleteFile sfilename
  417.         QueueFile = False
  418.         Exit Function
  419.     End If
  420.     Print "Queueing:"; sfilename
  421.  
  422.     AddToMsgFile sfilename
  423.  
  424.     If Basic.OS = ebWin32 Then
  425.         resultl = AddToDoList32(service, sfilename, "messages", queueflags)
  426.     Else
  427.         result = AddToDoList16(service, sfilename, "messages", queueflags)
  428.     End If
  429.  
  430.     ' Run import if it isn't already running
  431.     If ReadIni$("Main", "Stop Import", Session.inifilename) = "NO" then
  432.         Runimport
  433.     End If
  434.     QueueFile = True
  435.     Exit Function
  436. QueueFile_error:
  437.     Print "File:"; sfilename; " "; Error$
  438.     QueueFile = True
  439.     Exit Function
  440. End Function
  441.  
  442. 'T:QueueFileList (function) (Global)
  443. 'Queue a file for adding to the message base
  444. Function QueueFileList(service As String, sfilename As String, topic As String) As Boolean
  445.     Dim fname As String
  446.     Dim result As Integer, resultl As Long
  447.  
  448.     On Error Goto QueueFileList_error
  449.     If Filelen(sfilename) = 0 Then
  450.         Print "File:"; sfilename; " is empty"
  451.         LogResult "File was empty"
  452.         DeleteFile sfilename
  453.         QueueFileList = False
  454.         Exit Function
  455.     End If
  456.     Print "Queueing:"; sfilename
  457.  
  458.     If Basic.OS = ebWin32 Then
  459.         resultl = AddToDoList32(service, sfilename, topic, IM_DELETE)
  460.     Else
  461.         result = AddToDoList16(service, sfilename, topic, IM_DELETE)
  462.     End If
  463.  
  464.     ' Run import if it isn't already running
  465.     If ReadIni$("Main", "Stop Import", Session.inifilename) = "NO" then
  466.         Runimport
  467.     End If
  468.     QueueFileList = True
  469.     Exit Function
  470. QueueFileList_error:
  471.     Print "File:"; sfilename; " "; Error$
  472.     QueueFileList = True
  473.     Exit Function
  474. End Function
  475.  
  476. 'T:RunImport (subroutine)
  477. 'This routine runs import if it needs to be run
  478. Sub RunImport
  479.     Dim exepath As String, UserName As String
  480.     Dim UserNumber as String, ForgroundImport as String
  481.     Dim SlashUID as Integer, SlashUser as Integer
  482.     Dim VisibleType as Integer
  483.     On Error resume next
  484.  
  485.     'Workout who the user is so I know what USERNAME.ini file to use
  486.     SlashUser = Instr(Command$, "/USER=")
  487.  
  488.     'Workout which user logon (/2 /3 etc) this is as well so I know what section to use
  489.     SlashUID=Instr(SlashUser+2, Command$, "/UID=")
  490.     If SlashUID > 0 then
  491.         UserName = Left$(Trim$(Mid$(Command$, SlashUser + 6, SlashUID - SlashUser - 6)),8)
  492.         UserNumber = "/" & Right$(Command$, 1)
  493.     Else
  494.         UserName = Left$(Trim$(Right$(Command$, Len(Command$)-SlashUser - 5)),8)
  495.         UserNumber = ""
  496.     End If
  497.  
  498.     'Now check the Import To Forground= setting
  499.     ForgroundImport = ReadIni$("Main" & UserNumber, "Import To Foreground", MakeFilename(ReadIni$("Main", "User Path", Session.inifilename), UserName & ".ini"))
  500.     If ForgroundImport = "YES" then
  501.         'Visible with focus
  502.         VisibleType = 1
  503.     Else
  504.         'Minimised whithout focus
  505.         VisibleType = 7
  506.     End If        
  507.  
  508.     ' Run import/import32
  509.     StartImport VisibleType
  510. End Sub
  511.  
  512. 'T:AddToFile (subroutine) (global)
  513. ' This takes an input file and it appends it onto another
  514. Sub AddToFile (TargetFileName As String, SourceFileName as String)
  515.     Dim MsgFileNum as Integer, SourceFileNum as Integer
  516.     Dim MsgFileAt as Long, SourceFileAt as Long
  517.     Dim MsgFileLen as Long, SourceFileLen as Long
  518.     Dim TheData as String
  519.     Dim BytesToRead as Long
  520.  
  521.     On Error Goto AddToFile_error
  522.  
  523.     If FileExists(TargetFileName) Then
  524.         MsgFileLen = FileLen(TargetFileName)
  525.     Else
  526.         MsgFileLen = 0
  527.     End If
  528.     MsgFileAt = MsgFileLen + 1    'write point
  529.     MsgFileNum = FreeFile()
  530.     Open TargetFileName For Binary Access Read Write Shared As #MsgFileNum
  531.     
  532.     SourceFileLen = FileLen(SourceFileName)
  533.     BytesToRead = SourceFileLen
  534.     SourceFileNum = FreeFile()
  535.     Open SourceFileName for Binary Access Read Shared as #SourceFileNum
  536.     SourceFileAt = 1        'read point
  537.  
  538.     TheData = String$(BlockSize, " ")
  539.     
  540.     ' Operate on blocks of BlockSize at a time
  541.     Do While BytesToRead > BlockSize
  542.         Get #SourceFileNum, SourceFileAt, TheData
  543.         Put #MsgFileNum, MsgFileAt, TheData
  544.         BytesToRead = BytesToRead - BlockSize
  545.         SourceFileAt = SourceFileAt + BlockSize
  546.         MsgFileAt = MsgFileAt + BlockSize
  547.     Loop
  548.  
  549.     ' Now do the last block of less than BlockSize
  550.     If BytesToRead > 0 then
  551.         TheData = String$(BytesToRead, " ")
  552.         Get #SourceFileNum, SourceFileAt, TheData
  553.         Put #MsgFileNum, MsgFileAt, TheData
  554.     End If
  555.     
  556.     Close #MsgFileNum
  557.     Close #SourceFileNum
  558.     Exit Sub
  559.  
  560. AddToFile_error:
  561.     LogResult "Error in AddToFile : " + Str$(Err) + " in line " + Str$(Erl) + ":" + Error$
  562.     Close #SourceFileNum
  563.     Close #MsgFileNum
  564.     Exit Sub
  565. End Sub
  566.  
  567. 'T:AddToMsgFile (subroutine) (global)
  568. ' This takes an input file and it appends it onto ~\VAPATH\service\service.msg file for backups
  569. Sub AddToMsgFile (SourceFileName as String)
  570.     Dim MsgFileName As String
  571.     MsgFileName = Session.ServicePath & Left$(Session.Service, 8) & ".msg"
  572.     AddToFile MsgFileName, SourceFileName
  573. End Sub
  574.  
  575. 'T:AddBackslash (subroutine) (global)
  576. ' This takes an input string and ensures that the final character is a "\"
  577. Sub AddBackSlash (byRef APath as String)
  578.     If Right$(APath, 1) <> "\" Then APath = APath & "\"
  579. End Sub
  580.  
  581. 'T:LoadAddonLibraries (subroutine) (global)
  582. Sub LoadAddonLibraries
  583. '***************************************************************************
  584. '* Purpose: Loads Addon Script Files                                       *
  585. '*                                                                         *
  586. '* Inputs :                                                                *
  587. '*                                                                         *
  588. '* Returns:                                                                *
  589. '*                                                                         *
  590. '* ----------------------------------------------------------------------- *
  591. '* Revision History                                                        *
  592. '* Date:    Author:   Comments:                                            *
  593. '* ----------------------------------------------------------------------- *
  594. '* 31/01/96 AGB       Created                                              *
  595. '***************************************************************************
  596.  
  597. Dim sAddonsLine As String
  598. Dim sAddon As String
  599. Dim sScriptFile As String
  600. Dim sMsg As String
  601.  
  602.     On Error Goto Error_LoadAddonLibraries
  603.  
  604.     ' Get Addons= line from ashmount.ini
  605.     sAddonsLine = ReadIni$("Main", "Addons", Session.IniFileName)
  606.  
  607.     ' Process addon line
  608.     Do While Len(sAddonsLine) <> 0
  609.  
  610.         ' Extract each addon
  611.         sAddon = ParseString(sAddonsLine,",")
  612.         sAddon = Trim(sAddon)
  613.  
  614.         ' Get ScriptFile= line addon section of ashmount.ini
  615.         sScriptFile = ReadIni$("Addon." & sAddon, "ScriptFile", Session.IniFileName)
  616.  
  617.         If sScriptFile <> "" Then 
  618.             ' Check if file exists
  619.             If FileExists(Session.ServicePath & sScriptFile) = True Then
  620.                 LoadScript sScriptFile
  621.             End If
  622.         End If
  623.  
  624.     Loop
  625.  
  626.     Exit Sub
  627.  
  628. Error_LoadAddonLibraries:
  629.  
  630.     LogResult "Error loading addon libraries"
  631. End Sub
  632.  
  633. 'T:MyDate (function) (Global)
  634. Function MyDate$
  635.     MyDate = FormattedDateTime()
  636. End Function
  637.  
  638. 'T:RecordFileDownload (subroutine) (Global)
  639. Sub RecordFileDownload(topic As String, fname As String)
  640.     Dim fn As String
  641.  
  642.     fn = Session.ServicePath+"files.ww"
  643.     Open fn For Append Access Read Write Shared As #11
  644.     Print #11, topic+" "+fname
  645.     Close #11
  646. End Sub
  647.  
  648. 'T:FileUrl (function) (Global)
  649. Function FileUrl(fn As String) As String
  650.     If InStr(fn, " ")=0 Then
  651.         FileUrl = "FILE://" + fn
  652.     Else
  653.         FileUrl = "FILE://""" + fn + """"
  654.     End If
  655. End Function
  656.  
  657.  
  658.