home *** CD-ROM | disk | FTP | other *** search
/ .net 1999 December / netCD65.iso / pc / Software / VirtualA / 32bit / vasetup.exe / %MYDIR% / BASIC.EBS < prev    next >
Encoding:
Text File  |  1999-10-06  |  29.4 KB  |  1,108 lines

  1. 'T:BASIC.EBS for CompuServe
  2. ' VA 4.52 release
  3.  
  4. Global Const IM_DELETE    = 2048
  5.  
  6. Declare Function UniqueFileName$
  7. Declare Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean
  8. Declare Sub ReportSuccess(id As String)
  9. Declare Function StartCapture(pseudo As String)
  10. Declare Function NoSpaces(s As String) As String
  11. Declare Function GoForum(ByVal forum As String) As Boolean
  12. Declare Sub ResetForum
  13. Declare Sub UsenetOptions(id As String, realname As String, organisation As String, limit As String)
  14. Declare Function ParseString(args As String, delim As String) As String
  15. Declare Function ForumName(forum As String) As String
  16. Declare Function ToSpaces(s As String) As String
  17. Declare Function GetNumMessages() As Integer
  18. Declare Sub SetNumMessages(num As Integer)
  19. Declare Sub TimedWaitForPrompt(prefix As String, timeout As Integer)
  20. Declare Function FileUrl(fn As String) As String
  21.  
  22. Public MailName As String      'My name for mail purposes
  23. Public DownloadDir As String    'where downloads go
  24.  
  25. Dim numpages As Integer  ' Number of pages recieved used by CapturePages()
  26. Dim pseudo As String     ' "conf/topic from" used by CapturePages()
  27. Dim cleanup As Boolean     ' Workaround bug in CIS Euro What's New
  28. Dim search As String     ' Used for search (dictionary etc) scripts
  29. Dim HasFailed As Boolean ' A failure has been detected (eg No records found)
  30. Dim Submenu As Boolean     ' Send a '2\r' at the next prompt
  31. Dim SetPagedOutputToNO As Boolean
  32. Dim SetEditorToNO As Boolean
  33.  
  34. 'T:SetFailed (subroutine) (CompuServe)
  35. Sub SetFailed(t As Tracker)
  36.     HasFailed = True
  37.     t.reset
  38. End Sub
  39.  
  40. 'T:PageSplitter (subroutine) (CompuServe)
  41. ' Split message stream up
  42. Sub PageSplitter(t As Tracker)
  43.     ' End of previous message
  44.     CaptureRewind Len(t.match)
  45.     CaptureText Basic.Eoln$+"!end"
  46.  
  47.     ' Start of next message
  48.     CaptureText Basic.Eoln$+"!start "+pseudo+Basic.Eoln$
  49.  
  50.     ' Tell user we've got another message
  51.     numpages = numpages + 1
  52.     Terminal.CaptureStatus numpages
  53.     t.reset
  54. End Sub
  55.  
  56. 'T:SendSearch (subroutine) (CompuServe)
  57. ' Sends the 'search' string and then just sends a '\r' next time.
  58. Sub SendSearch(t As Tracker)
  59.     If search="" Then
  60.         CaptureRewind Len(t.match)
  61.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  62.         If HasFailed Then
  63.             Capture CAPTURE_OFF
  64.         End If
  65.     End If
  66.     t.reset
  67.     Comms.Send search+"\r"
  68.     search = ""
  69. End Sub
  70.  
  71. 'T:Rewind (subroutine) (CompuServe)
  72. ' Removes the match from the capture file
  73. Sub Rewind(t As Tracker)
  74.     CaptureRewind Len(t.match)
  75.     t.reset
  76. End Sub
  77.  
  78. 'T:SetSubmenu (subroutine) (CompuServe)
  79. ' Sets flag to choose item 2 at the next menu prompt.
  80. Sub SetSubmenu(t As Tracker)
  81.     t.reset
  82.     Submenu = True
  83. End Sub
  84.  
  85. Function ContainsWildCard(pattern As String) As Boolean
  86.     ContainsWildCard = False
  87.     If instr(pattern, "*") Then ContainsWildCard = True
  88.     If instr(pattern, "?") Then ContainsWildCard = True
  89.     If instr(pattern, "[") Then ContainsWildCard = True
  90. End Function
  91.  
  92. 'T:CapturePages (subroutine) (CompuServe)
  93. ' Generic routine for getting 'all' news articles
  94. Sub CapturePages(id As String, forum As String, menuid As String, _
  95.     ppseudo As String, endofmsg As String, pcleanup As Boolean, _
  96.     prompt As String, psearch As String, notfound As String, _
  97.     morestr As String, doall As Boolean)
  98.  
  99.     Dim tSearch As Tracker, tStart As Tracker, tRewind As Tracker
  100.     Dim tNotFound As Tracker, tSubmenu As Tracker, tEnd1 As Tracker
  101.     Dim tEnd2 As Tracker, tEnd3 As Tracker, filename As String
  102.  
  103.     ' Go to main page
  104.     If Not GoForum(forum) Then
  105.         LogResult "Failed trying to GO "+forum
  106.         Exit Sub
  107.     End If
  108.  
  109.     ' Store in a global
  110.     pseudo = ppseudo
  111.     cleanup = pcleanup
  112.     search = psearch
  113.     HasFailed = False
  114.     Submenu = False
  115.  
  116.     ' Setup tracker for answering the search request
  117.     If prompt<>"" Then
  118.         Set tSearch = CreateTracker("SearchPrompt", prompt, "SendSearch", False, ContainsWildCard(prompt))
  119.     End If
  120.     If notfound<>"" Then
  121.         Set tNotFound = CreateTracker("NotFound", notfound, "SetFailed", False, ContainsWildCard(notfound))
  122.     End If
  123.  
  124.     ' Start capturing
  125.     numpages = 0
  126.     filename = UniqueFilename$()
  127.     Capture CAPTURE_ON, filename
  128.     Set tStart = CreateTracker("MessageStart", endofmsg, "PageSplitter", True, ContainsWildCard(endofmsg))
  129.     Set tRewind = CreateTracker("Rewind", "\nChoice*is not available for download", "Rewind", False, True)
  130.     If morestr<>"" Then
  131.         Set tSubmenu = CreateTracker("Submenu", morestr, "SetSubmenu", False, ContainsWildCard(morestr))
  132.     End If
  133.     Set tEnd1 = CreateTracker("PromptLastEnd1", "\nNo next page. Key M for menu or T for top!", "", False, True)
  134.     Set tEnd2 = CreateTracker("PromptLastEnd2", "\nMenu Choices currently invalid. Enter M for Menu.!", "", False, True)
  135.     Set tEnd3 = CreateTracker("PromptLastPrompt", "\n!", "", False, True)
  136.  
  137.     ' Go to submenu item if there is one
  138.     If menuid<>"" Then
  139.         Comms.Send menuid+"\r"
  140.         WaitForPrompt "Prompt"
  141.         CaptureRewind 1
  142.     End If
  143.  
  144.     ' Go to submenu item if there is one
  145.     If Submenu Then
  146.         numpages = 0
  147.         Comms.Send "2\r"
  148.         WaitFor "2"
  149.         CaptureRewind 1
  150.         WaitForPrompt "Prompt"
  151.         CaptureRewind 1
  152.     End If
  153.  
  154.     ' Get all messages
  155.     If HasFailed Then
  156.         Comms.Send "\r"
  157.         WaitForPrompt "Prompt"
  158.     Else
  159.         If numpages<>1 Or doall Then
  160.             numpages = 0
  161.             Terminal.CaptureStatus CAPTURE_ON
  162.             Terminal.Enabled = False
  163.             Comms.Send "all\r"
  164.             WaitFor "all"
  165.             CaptureRewind 3
  166.             WaitForPrompt "PromptLast"
  167.  
  168.             If PromptMatches("PromptLastEnd1") Then CaptureRewind 42
  169.             If PromptMatches("PromptLastEnd2") Then CaptureRewind 50
  170.             If PromptMatches("PromptLastPage") Then CaptureRewind 10
  171.             If PromptMatches("PromptLastPrompt") Then CaptureRewind 1
  172.             Terminal.CaptureStatus CAPTURE_OFF
  173.         End If
  174.     End If
  175.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  176.  
  177.     ' Clean up
  178.     tStart.delete
  179.     tRewind.delete
  180.     tEnd1.delete
  181.     tEnd2.delete
  182.     tEnd3.delete
  183.     If prompt<>"" Then tSearch.delete
  184.     If notfound<>"" Then tNotFound.delete
  185.     If morestr<>"" Then tSubmenu.delete
  186.     Capture CAPTURE_OFF
  187.     If cleanup Then
  188.         Comms.Send "m\rgo top\r"
  189.         WaitForPrompt "Prompt"
  190.         On Error Goto Timeout_Error
  191.         TimedWaitForPrompt "Prompt", 1 ' catch an extra prompt if there is one
  192. Timeout_Error:
  193.         On Error Goto 0
  194.     End If
  195.     If prompt<>"" Then
  196.         GoTop
  197.     Else
  198.         ResetForum
  199.     End If
  200.     Terminal.Enabled = True
  201.     ' Add to import queue
  202.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  203.         ReportSuccess id & " : Information from " & forum & " collected "
  204.     End If
  205. End Sub
  206.  
  207. 'T:Eberts (subroutine) (CompuServe)
  208. Sub Eberts(id As String)
  209.     CapturePages id, "cis:ebert", "1", "Ebert/Recent_Reviews Roger_Ebert", _
  210.         "\nMovies/Roger Ebert\r", False, "", "", "", "", True
  211. End Sub
  212.  
  213. 'T:Groliers (subroutine) (CompuServe)
  214. Sub Groliers(id As String, txt As String)
  215.     CapturePages id, "cis:aae", "1", "Encyclopedia/Groliers "+NoSpaces(txt), _
  216.         "\nGrolier's", False, "\nSearch term: ", txt, _
  217.         "\nNo listings were found", "\nArticles selected:*that begin", True
  218. End Sub
  219.  
  220. 'T:Hutchinson (subroutine) (CompuServe)
  221. Sub Hutchinson(id As String, txt As String)
  222.     Dim t As Tracker
  223.  
  224.     ' Install handler for images
  225.     Set t = CreateTracker("StartDownload", "\nEnter ""DOWN"" to download!", "SendCR")
  226.  
  227.     CapturePages id, "cis:hutchinson", "1", _
  228.         "Encyclopedia/Hutchinsons "+NoSpaces(txt), "\nHutchinson", _
  229.         False, "\nEnter*Search Term: ", txt, "\nNo records found", _
  230.         "\nArticles Found:*that begin", True
  231.  
  232.     t.delete
  233. End Sub
  234.  
  235. 'T:Dictionary (subroutine) (CompuServe)
  236. Sub Dictionary(id As String, txt As String)
  237.     CapturePages id, "cis:dictionary", "4", _
  238.         "Dictionary/Words "+NoSpaces(txt), "\nCompuServe", _
  239.         False, "\nSearch term: ", txt, "\nNo listings were found", _
  240.         "\nDefinitions found:*that begin", False
  241. End Sub
  242.  
  243. 'T:Drugs (subroutine) (CompuServe)
  244. Sub Drugs(id As String, txt As String)
  245.     CapturePages id, "cis:drugs", "6", _
  246.         "Drugs/Reference "+NoSpaces(txt), "\nDrug Reference", _
  247.         False, "\nSearch term (or /HELP): ", txt, "\nNo listings were found", _
  248.         "\nDrug names found:*that begin", True
  249. End Sub
  250.  
  251. 'T:Lexikon (subroutine) (CompuServe)
  252. Sub Lexikon(id As String, txt As String)
  253.     CapturePages id, "cis:beplexikon", "4", _
  254.         "Bertelsmann/Lexikon "+NoSpaces(txt), _
  255.         "\nBertelsmann Lexikon*BRT-*\r", False, "\nSuchbegriff: ", _
  256.         txt, "\nKein Eintrag gefunden", "\nEs wurden*Artikel gefunden, die mit", False
  257. End Sub
  258.  
  259. 'T:SendB (subroutine) (global)
  260. 'Sends a "b" to the service
  261. Sub SendB(t As Tracker)
  262.     Comms.Send "b\r"
  263.     t.reset
  264. End Sub
  265.  
  266. 'T:MSL (subroutine) (CompuServe)
  267. Sub MSL(id As String, remote As String, filename As String)
  268.     Dim t As Tracker, tProt As Tracker
  269.  
  270.     If Not GoForum("cis:msl") Then
  271.         LogResult "Unable to enter MS Library."
  272.         Exit Sub
  273.     End If
  274.  
  275.     Set t = CreateTracker("PromptNoRecords", "no records found")
  276.     Comms.Send "2\r"
  277.     WaitForPrompt "Prompt"
  278.     Comms.Send "4\r"
  279.     WaitFor "ame:"
  280.     Comms.Send remote+"\r"
  281.     WaitForPrompt "Prompt"
  282.     t.delete
  283.  
  284.     ' Any matches?
  285.     If PromptMatches("PromptNoRecords") Then
  286.         LogResult "No matches for ["+remote+"] from MSL."
  287.         WaitForPrompt "Prompt"
  288.         GoTop
  289.         ReportSuccess id & " : No matches for " & remote & " found in MSL "
  290.         Exit Sub
  291.     End If
  292.  
  293.     ' Go and download it
  294.     Comms.Send "5\r"
  295.     Set t = CreateTracker("PromptDownload", "download!")
  296.     WaitForPrompt "Prompt"
  297.     t.delete
  298.  
  299.     ' Only download if there is exactly one match
  300.     If PromptMatches("PromptDownload") Then
  301.         Set tProt = CreateTracker("SendProtocol", "Y) :", "SendB", False, False)
  302.         Comms.Send "down\r"
  303.         WaitFor "computer :"
  304.         Comms.SendLiteral DownloadDir+filename
  305.         Comms.Send "\r"
  306.         WaitForPrompt "Prompt"
  307.     Else
  308.         LogResult "Error while trying to download "+remote+" from MSL."
  309.     End If
  310.  
  311.     ' Clean up
  312.     GoTop
  313.     ReportSuccess id & " : " & FileUrl(DownloadDir+filename) & " downloaded from MSL "
  314. End Sub
  315.  
  316. 'T:MSKB (subroutine) (CompuServe)
  317. Sub MSKB(id As String, keywords As String)
  318.     Dim tEnd1 As Tracker, tEnd2 As Tracker, tStart As Tracker
  319.     Dim tNotFound As Tracker
  320.     Dim filename As String, tmp As String
  321.  
  322.     ' Go to main page
  323.     If Not GoForum("cis:mskb") Then
  324.         LogResult "Failed trying to GO MSKB"
  325.         Exit Sub
  326.     End If
  327.  
  328.     If UCase$(Mid(keywords,1,1))="Q" Or IsNumeric(keywords) Then
  329.         ' Old style MSKB
  330.         Comms.Send "6\r"
  331.         WaitFor ":"
  332.         Comms.Send keywords+"\r"
  333.  
  334.         Set tEnd1 = CreateTracker("PromptEnd1", "\nLast page. Enter ""DOWN"" to download!")
  335.         Set tEnd2 = CreateTracker("PromptEnd2", "\nPress <CR> for more, or ""DOWN"" to download!")
  336.         filename = UniqueFilename$()
  337.         WaitFor keywords
  338.         Capture CAPTURE_ON, filename
  339.         CaptureText "!start Mskb/Download Microsoft "+Basic.Eoln$+keywords+Basic.Eoln$
  340.         WaitForPrompt "Prompt"
  341.  
  342.         ' Clear up
  343.         If PromptMatches("PromptEnd2") Then
  344.             CaptureRewind 43
  345.         Else
  346.             CaptureRewind 36
  347.         End If
  348.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  349.         Capture CAPTURE_OFF
  350.         tEnd1.delete
  351.         tEnd2.delete
  352.         GoTop
  353.  
  354.         ' Add to import queue
  355.         If QueueFile(Session.Service, filename, IM_DELETE) Then
  356.             ReportSuccess id & " : Document : " & keywords & " collected from MSKB "
  357.         End If
  358.     Else
  359.         HasFailed = False
  360.         pseudo = "Mskb/Download Microsoft"
  361.  
  362.         Comms.Send "4\r"
  363.         WaitForPrompt "Prompt"
  364.  
  365.         Set tNotFound = CreateTracker("NotFound", "no documents found that match", "SetFailed")
  366.  
  367.         If Mid$(keywords, 1, 1)="!" Then
  368.             Comms.Send "6\r"
  369.             tmp = Mid$(keywords, 2)
  370.         Else
  371.             Comms.Send "7\r"
  372.             tmp = keywords
  373.         End If
  374.         WaitFor "1:"
  375.         Comms.Send ParseString(tmp, " ")+"\r"
  376.  
  377.         WaitFor "2:"
  378.         If tmp<>"" Then
  379.             Comms.Send ParseString(tmp, " ")+"\r"
  380.  
  381.             WaitFor "3:"
  382.             Comms.Send ParseString(tmp, " ")+"\r"
  383.         Else
  384.             Comms.Send "\r"
  385.         End If
  386.  
  387.         WaitForPrompt "PromptMain"
  388.         tNotFound.delete
  389.  
  390.         ' Has it failed ?
  391.         If HasFailed Then
  392.             Comms.Send "\r"
  393.             WaitForPrompt "PromptMain"
  394.             ResetForum
  395.  
  396.             ' Report an error
  397.             ReportSuccess id & " : MSKB search : no matches."
  398.             Exit Sub
  399.         End If
  400.  
  401.         ' Start capturing
  402.         Comms.Send "8\r"
  403.         WaitFor "8\r"
  404.         Terminal.Enabled = False
  405.         numpages = 0
  406.         filename = UniqueFilename$()
  407.         Capture CAPTURE_ON, filename
  408.         Set tStart = CreateTracker("MessageStart", "\nKnowledge Base", "PageSplitter")
  409.         Set tEnd1  = CreateTracker("PromptEnd1", "\nLast page. Enter ""DOWN"" to download!")
  410.         Set tEnd2  = CreateTracker("PromptEnd2", "\nPress <CR> for more, or ""DOWN"" to download!")
  411.  
  412.         WaitForPrompt "Prompt"
  413.         If PromptMatches("PromptMain") Then
  414.             Comms.Send "all\r"
  415.             WaitForPrompt "Prompt"
  416.         End If
  417.  
  418.         ' The End
  419.         If PromptMatches("PromptEnd2") Then
  420.             CaptureRewind 43
  421.         Else
  422.             CaptureRewind 36
  423.         End If
  424.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  425.         Terminal.CaptureStatus CAPTURE_OFF
  426.         Capture CAPTURE_OFF
  427.  
  428.         ' Clean up
  429.         tStart.delete
  430.         tEnd1.delete
  431.         tEnd2.delete
  432.         Comms.Send "\r"
  433.         WaitForPrompt "Prompt"
  434.         ResetForum
  435.         Terminal.Enabled = True
  436.  
  437.         ' Add to import queue
  438.         If QueueFile(Session.Service, filename, IM_DELETE) Then
  439.             ReportSuccess id & " : Information from Mskb collected"
  440.         End If
  441.     End If
  442. End Sub
  443.  
  444. 'T:CountSelection(t As Tracker)
  445. Sub CountSelection(t As Tracker)
  446.     Dim s As String
  447.     Dim i As Integer
  448.  
  449.     If HasFailed=False Then
  450.         s = ""
  451.         For i = 1 To Len(t.match)
  452.             If IsNumeric(Mid(t.match, i, 1)) Then
  453.                 s = Mid(t.match, i)
  454.                 Exit For
  455.             End If
  456.         Next
  457.         If InStr(s, " ")>0 Then
  458.             s = Mid(s, 1, InStr(s, " ")-1)
  459.             If Len(s) >= 5 Then
  460.                 numpages = 32760
  461.             Else
  462.                 numpages = Val(s)
  463.             End If
  464.         End If
  465.     End If
  466.     t.reset
  467. End Sub
  468.  
  469. 'T:FileFinder (subroutine) (CompuServe)
  470. Sub FileFinder(id As String, goWord As String, keywords As String, ftype As String, _
  471.     fext As String, filename As String, limit As String, getdetail As String)
  472.     Dim tmp As String, fname As String, finder As String
  473.     Dim i As Integer
  474.     Dim t1 As Tracker, t2 As Tracker, t3 As Tracker, t4 As Tracker
  475.     Dim t5 As Tracker, t6 As Tracker, t7 As Tracker, t8 As Tracker
  476.  
  477.     ' Extract the GO word
  478.     finder = Mid$(goWord, InStr(goWord, "(")+1)
  479.     finder = Mid$(finder, 1, Len(finder)-1)
  480.     goWord = ParseString(goWord, " ")
  481.  
  482.     ' default to 100 limit
  483.     If limit="" Then limit="100"
  484.     If goWord="GAMEFF" Then goWord = "GMF-10"
  485.  
  486.     If Not GoForum(goWord) Then
  487.         LogResult finder+" unavailable."
  488.         Exit Sub
  489.     End If
  490.  
  491.     If goWord="GMF-10" Then
  492.         Comms.Send "9\r"
  493.     Else
  494.         Comms.Send "1\r"
  495.     End If
  496.     WaitForPrompt "PromptMain"
  497.  
  498.     ' Install error handler
  499.     HasFailed = False
  500.     numpages = 0
  501.     Set t1 = CreateTracker("Failed", "\nThere were no articles located that match your search criteria.", "SetFailed")
  502.     Set t2 = CreateTracker("Selection", "\nCurrent selection*file", "CountSelection", False, True)
  503.  
  504.     ' (1) Request keyword search.
  505.     If keywords<>"" Then
  506.         tmp = keywords
  507.         Comms.Send "1\r"
  508.  
  509.         WaitFor "1:"
  510.         Comms.Send ParseString(tmp, " ")+"\r"
  511.  
  512.         WaitFor "2:"
  513.         If tmp<>"" Then
  514.             Comms.Send ParseString(tmp, " ")+"\r"
  515.  
  516.             WaitFor "3:"
  517.             Comms.Send ParseString(tmp, " ")+"\r"
  518.         Else
  519.             Comms.Send "\r"
  520.         End If
  521.  
  522.         WaitForPrompt "PromptMain"
  523.     End If
  524.  
  525.     ' (2) We don't do date since it seems to hang CIS rather a lot.
  526.  
  527.     ' (3) We don't do forum search since we'd have to pick from a list
  528.     ' which is slow and a pain.
  529.  
  530.     ' (4) File type - accepts number or text
  531.     If HasFailed=False And ftype<>"" And UCase(Mid(ftype, 1, 2))<>"AN" Then
  532.         ' Validate the type
  533.         tmp = UCase(Mid(ftype, 1, 1))
  534.         i = InStr("ABIRNGJ", tmp)
  535.         If i<>0 Then tmp = Str$(i+1)
  536.         If InStr("12345678", tmp) Then
  537.             Comms.Send "4\r"
  538.             WaitForPrompt "PromptMain"
  539.             Comms.Send tmp+"\r"
  540.             WaitForPrompt "PromptMain"
  541.         End If
  542.     End If
  543.  
  544.     ' (5) File Extension
  545.     If HasFailed=False And fext<>"" Then
  546.         Comms.Send "5\r"
  547.         WaitFor "):"
  548.         Comms.Send fext+"\r"
  549.         WaitForPrompt "PromptMain"
  550.     End If
  551.  
  552.     ' (6) File Name
  553.     If HasFailed=False And filename<>"" Then
  554.         Comms.Send "6\r"
  555.         WaitFor "):"
  556.         Comms.Send filename+"\r"
  557.         WaitForPrompt "PromptMain"
  558.     End If
  559.  
  560.     ' (7) Submitter isn't handled because it causes loads of problems
  561.     ' Submitter ID:
  562.  
  563.     ' If too many matches then don't bother
  564.     If limit<>"" And numpages > Val(limit) Then
  565.         HasFailed = True
  566.     End If
  567.  
  568.     ' Display it
  569.     t1.delete
  570.     t2.delete
  571.     tmp = finder
  572.     pseudo = "File_Finder/"+ParseString(tmp, " ")+" CompuServe"
  573.     If HasFailed Then
  574.         fname = StartCapture(pseudo)
  575.         CaptureText keywords+", "+ftype+", "+fext+", "+filename+", " _
  576.             +limit+", "+getdetail+Basic.Eoln$
  577.         If limit<>"" And numpages > Val(limit) Then
  578.             CaptureText "There were too many articles located that match your search criteria."
  579.         Else
  580.             CaptureText "There were no articles located that match your search criteria."
  581.         End If
  582.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  583.     Else
  584.         Comms.Send "8\r"
  585.         WaitFor "8\r"
  586.  
  587.         ' Start capturing
  588.         fname = StartCapture(pseudo)
  589.         CaptureText keywords+", "+ftype+", "+fext+", "+filename+", " _
  590.             +limit+", "+getdetail+Basic.Eoln$
  591.  
  592.         WaitForPrompt "Prompt"
  593.         CaptureRewind 1
  594.         CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  595.  
  596.         If UCase(Mid(getdetail,1,1))="Y" And numpages>1 Then
  597.             numpages = 0
  598.             Set t1 = CreateTracker("MessageStart1", "\nPC File Finder", "PageSplitter")
  599.             Set t2 = CreateTracker("MessageStart2", "\nGraphics File Finder", "PageSplitter")
  600.             Set t3 = CreateTracker("MessageStart3", "\nGames File Finder", "PageSplitter")
  601.             Set t4 = CreateTracker("MessageStart4", "\nMS File Finder", "PageSplitter")
  602.             Set t5 = CreateTracker("MessageStart5", "\nAmiga File Finder", "PageSplitter")
  603.             Set t6 = CreateTracker("MessageStart6", "\nAtari File Finder", "PageSplitter")
  604.             Set t7 = CreateTracker("MessageStart7", "\nMAC File Finder", "PageSplitter")
  605.             Set t8 = CreateTracker("MessageStart8", "\nWindows File Finder", "PageSplitter")
  606.             Terminal.CaptureStatus CAPTURE_ON
  607.             Terminal.Enabled = False
  608.  
  609.             ' Get all messages
  610.             Comms.Send "all\r"
  611.             WaitForPrompt "PromptLastPage"
  612.             CaptureRewind 10
  613.             CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  614.             Terminal.CaptureStatus CAPTURE_OFF
  615.             Terminal.Enabled = True
  616.             If NoSpaces(finder)="WINFF" Then
  617.                 Comms.Send "go top\r"
  618.             Else
  619.                 Comms.Send "\r"
  620.             End If
  621.             WaitForPrompt "PromptMain"
  622.             t1.delete
  623.             t2.delete
  624.             t3.delete
  625.             t4.delete
  626.             t5.delete
  627.             t6.delete
  628.             t7.delete
  629.             t8.delete
  630.         Else
  631.             CaptureRewind 1
  632.             CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  633.         End If
  634.     End If
  635.  
  636.     ' Clean up
  637.     Capture CAPTURE_OFF
  638.     GoTop
  639.  
  640.     ' Add to import queue
  641.     If QueueFile(Session.Service, fname, IM_DELETE) Then
  642.         ReportSuccess id & " : Search for " & keywords & ";" & ftype  & ";" & fext    & ";" &  filename & " "
  643.     End If
  644. End Sub
  645.  
  646. 'T:SetupOptions (subroutine) (CompuServe)
  647. Sub SetupOptions(id As String)
  648.     Dim tYN As Tracker, tNew As Tracker
  649.     Dim HitCR1 As Tracker, HitCR2 As Tracker, tName As Tracker
  650.     Dim t1 As Tracker, t2 As Tracker, tInvalid As Tracker
  651.  
  652.     ' Handle the odd CIS query automatically
  653.     Set tYN = CreateTracker("IsYN", "(Y or N) !")
  654.     Set tNew = CreateTracker("IsNew", "New:")
  655.     Set HitCR1 = CreateTracker("PromptMore1", "<CR> for more !", "SendCR")
  656.     Set HitCR2 = CreateTracker("PromptMore2", "Press <CR>!", "SendCR")
  657.     Set tName = CreateTracker("IsName", "name:")
  658.  
  659.     Comms.Bitmask = True
  660.     ' Set mail name
  661.     Comms.Send "go home:mail\r"
  662.     WaitForPrompt "Prompt"
  663.     Comms.Send "go home:mail\r"
  664.     WaitForPrompt "Prompt"
  665.     Comms.Send "address name\r"
  666.     WaitForPrompt "Is"
  667.     If PromptMatches("IsYN") Then
  668.         Comms.Send "y\r"
  669.         WaitForPrompt "Prompt"
  670.     Else
  671.         Comms.SendLiteral MailName
  672.         Comms.Send "\r"
  673.         Set tNew = CreateTracker("IsNew", "New:", "SendCR")
  674.         WaitFor "N) !"
  675.         Comms.Send "n\r"
  676.         WaitForPrompt "Prompt"
  677.         tNew.delete
  678.     End If
  679.     tYN.delete
  680.     tName.delete
  681.     Comms.Send "set retain yes\r"
  682.     WaitForPrompt "Prompt"
  683.     SetEditorToNO = False
  684.     SetPagedOutputToNO = False
  685.     Set t1 = CreateTracker("EdLineNum", "EDITOR uses line numbers [YES]", "EditorLineNum")
  686.     Set t2 = CreateTracker("PgOutput", "Output is PAGED [YES]", "PagedOutput")
  687.     Comms.Send "set\r"
  688.     WaitForPrompt "Prompt"
  689.     t1.Delete
  690.     t2.Delete
  691.     If SetEditorToNO = True then
  692.         Comms.Send "1\r"
  693.         WaitForPrompt "Prompt"
  694.     End If
  695.     If SetPagedOutputToNO = True then
  696.         Comms.Send "3\r"
  697.         WaitForPrompt "Prompt"
  698.     End If
  699.     Comms.Send "mode\r"
  700.     WaitForPrompt "Prompt"
  701.     Comms.Send "3\r"
  702.     WaitForPrompt "Prompt"
  703.     Comms.Send "\r"
  704.     WaitFor "!"
  705.     Comms.Send "y\r"
  706.     WaitForPrompt "Prompt"
  707.     tName.Delete
  708.  
  709.     Comms.Send "go default\r"
  710.  
  711.     ' Set options
  712.     WaitFor "!"
  713.     Comms.Send "2\r"
  714.     WaitFor "Enter"
  715.     WaitFor "!"
  716.     Comms.Send "2\r"
  717.     WaitFor "Enter"
  718.     WaitFor "!"
  719.     Comms.Send "1\r"
  720.     WaitFor "Enter"
  721.     WaitFor "!"
  722.     Comms.Send "1\r"
  723.     WaitFor "Enter"
  724.     WaitFor "!"
  725.     Comms.Send "2\r"
  726.     WaitFor "Enter"
  727.     WaitFor "!"
  728.     Comms.Send "2\r"
  729.     WaitFor "Enter"
  730.     WaitFor "!"
  731.     Comms.Send "4\r"
  732.     WaitFor "Enter"
  733.     WaitFor "!"
  734.     Comms.Send "4\r"
  735.     WaitFor "Enter"
  736.     WaitFor "!"
  737.     Comms.Send "5\r"
  738.     WaitFor "Enter"
  739.     WaitFor "!"
  740.     Comms.Send "1\r"
  741.     WaitFor "Enter"
  742.     WaitFor "!"
  743.     Comms.Send "6\r"
  744.     WaitFor "Enter"
  745.     WaitFor "!"
  746.     Comms.Send "2\r"
  747.     WaitFor "Enter"
  748.     WaitFor "!"
  749.     Comms.Send "\r"
  750.     WaitFor "Enter"
  751.     WaitFor "!"
  752.     Comms.Send "3\r"
  753.     WaitFor "Enter"
  754.     WaitFor "!"
  755.     Comms.Send "1\r"
  756.     WaitFor "Enter"
  757.     WaitFor "!"
  758.     Comms.Send "2\r"
  759.     WaitFor "Enter"
  760.     WaitFor "!"
  761.     Comms.Send "2\r"
  762.     WaitFor ".)"
  763.     WaitFor ".)"
  764.     WaitFor "Enter"
  765.     WaitFor "!"
  766.     Comms.Send "1\r"
  767.     WaitFor "!"
  768.     Comms.Send "\r"
  769.     WaitFor "Enter"
  770.     WaitFor "!"
  771.     Comms.Send "6\r" ' set english
  772.     WaitFor "Enter"
  773.     WaitFor "!"
  774.     Comms.Send "1\r"
  775.     WaitFor "Enter"
  776.     WaitFor "!"
  777.     Comms.Send "7\r"
  778.     WaitFor "Enter"
  779.     WaitFor "!"
  780.     Comms.Send "2\r"
  781.     WaitFor ":"
  782.     Comms.Send "\r"
  783.     WaitFor "Enter"
  784.     WaitFor "!"
  785.     Comms.Send "\r"
  786.     WaitFor "Enter"
  787.     WaitFor "!"
  788.     Comms.Send "4\r"
  789.     WaitFor "Enter"
  790.     WaitFor "!"
  791.     Comms.Send "1\r"
  792.     WaitFor "Enter"
  793.     WaitFor "!"
  794.  
  795.     'This handles the CIS Screw Up of making Term Type = 8 invalid
  796.     'even though it is on the menu!!!!!!!!!!! 
  797.     Set tInvalid=CreateTracker("CIS_Screw_Up", "\nEnter WIDTH \[10-255\] : ", "SendCR")
  798.  
  799.     Comms.Send "8\r"
  800.     WaitFor "!"
  801.  
  802.     Comms.Send "\r"
  803.  
  804.     tInvalid.Delete
  805.  
  806.     WaitFor "Enter"
  807.     WaitFor "!"
  808.     Comms.Send "2\r"
  809.     WaitFor ":"
  810.     Comms.Send "79\r"
  811.     WaitFor "Enter"
  812.     WaitFor "!"
  813.     Comms.Send "3\r"
  814.     WaitFor "page:"
  815.     Comms.Send "0\r"
  816.     WaitFor "Enter"
  817.     WaitFor "!"
  818.     Comms.Send "6\r"
  819.     WaitFor "Enter"
  820.     WaitFor "!"
  821.     Comms.Send "1\r"
  822.     WaitFor "Enter"
  823.     WaitFor "!"
  824.     Comms.Send "7\r"
  825.     WaitFor "Enter"
  826.     WaitFor "!"
  827.     Comms.Send "1\r"
  828.     WaitFor "Enter"
  829.     WaitFor "!"
  830.     Comms.Send "10\r"
  831.     WaitFor "Enter"
  832.     WaitFor "!"
  833.     Comms.Send "1\r"
  834.     WaitFor "Enter"
  835.     WaitFor "!"
  836.     Comms.Send "11\r"
  837.     WaitFor "Enter"
  838.     WaitFor "!"
  839.     Comms.Send "2\r"
  840.     WaitFor "Enter"
  841.     WaitFor "!"
  842.     Comms.Send "\r"
  843.     WaitFor "Enter"
  844.     WaitFor "!"
  845.     Comms.Send "5\r"
  846.     WaitFor "Enter"
  847.     WaitFor "!"
  848.     Comms.Send "1\r"
  849.     WaitFor "Enter"
  850.     WaitFor "!"
  851.     Comms.Send "2\r"
  852.     WaitFor "Enter"
  853.     WaitFor "!"
  854.     Comms.Send "\r"
  855.     WaitFor "Enter"
  856.     WaitFor "!"
  857.     Comms.Send "\r"
  858.     WaitFor "Enter"
  859.     WaitFor "!"
  860.     Comms.Send "\r"
  861.     WaitFor "Enter"
  862.     WaitFor "!"
  863.     Comms.Send "1\r"
  864.     WaitFor "!"
  865.     Comms.Send "\r"  ' Taz fix
  866.     HitCR1.Delete
  867.     HitCR2.Delete
  868.  
  869.     WriteIni "Service "+Session.Service, "Set Options", "YES", Session.IniFilename
  870.     If id<>"" Then
  871.         ReportSuccess id & " : CompuServe has been successfully configured for use with Virtual Access"
  872.     Else
  873.         LogResult "CompuServe has been successfully configured for use with Virtual Access"
  874.     End If
  875. End Sub
  876.  
  877. 'T:Directory (subroutine) (CompuServe)
  878. Sub Directory(id As String, lastname As String, forename As String, city As String, country As String, state As String)
  879.     Dim fname As String
  880.     Dim t1 As Tracker, t2 As Tracker, t3 As Tracker
  881.  
  882.     If Not GoForum("cis:directory") Then
  883.         LogResult "Membership Directory Failed."
  884.         Exit Sub
  885.     End If
  886.  
  887.     Comms.Send "2\r"
  888.     WaitFor "help)"
  889.  
  890.     ' Lastname
  891.     WaitFor ":"
  892.     Comms.Send lastname+"\r"
  893.  
  894.     ' Forename
  895.     WaitFor ":"
  896.     Comms.Send forename+"\r"
  897.  
  898.     WaitFor ":"
  899.     If Len(city)>0 Then
  900.         Comms.Send city+"\r"
  901.     Else
  902.         Comms.Send "\r"
  903.         WaitFor ":"
  904.         Comms.Send country+"\r"
  905.  
  906.         If StrComp(country, "USA", 1)=0 Or StrComp(country, "US", 1)=0 Then
  907.             WaitFor ":"
  908.             Comms.Send state+"\r"
  909.         End If
  910.     End If
  911.  
  912.     WaitFor "\nSearching..."
  913.  
  914.     ' Install some error traps
  915.     Set t1 = CreateTracker("DirBadCity", "\nCity : ")
  916.     Set t2 = CreateTracker("DirBadCountry", "\nCountry \[*\] : ", "", False, True)
  917.     Set t3 = CreateTracker("DirOK", "\nEnter search crit")
  918.  
  919.     ' Start capturing
  920.     fname = StartCapture("Directory/Members CompuServe")
  921.     CaptureText lastname+", "+forename+", "+city+", "+country+", " _
  922.         +state+Basic.Eoln$+Basic.Eoln$
  923.     CaptureText "Surname, Firstname                 Location, Country                    User Id"
  924.     WaitForPrompt "Dir"
  925.     If PromptMatches("DirOK") Then
  926.         CaptureRewind 17
  927.     End If
  928.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  929.     t1.delete
  930.     t2.delete
  931.     t3.delete
  932.  
  933.     ' Clean up
  934.     Capture CAPTURE_OFF
  935.     If PromptMatches("DirOK") Then
  936.         WaitFor ") :"
  937.     End If
  938.     Comms.Send "/exit\r"
  939.     WaitForPrompt "Prompt"
  940.  
  941.     ' Add to import queue
  942.     If QueueFile(Session.Service, fname, IM_DELETE) Then
  943.         ReportSuccess id & " : Search for " & lastname & ";" & forename & ";" & city & ";" & country & ";" & state & " " 
  944.     End If
  945. End Sub
  946.  
  947. 'T:SetSearch (subroutine) (CompuServe)
  948. Sub SetSearch(menuid As String, prompt As String, txt As String)
  949.     If HasFailed=False And txt<>"" And txt<>"0" And txt<>"1" Then
  950.         Comms.Send menuid+"\r"
  951.  
  952.         WaitFor prompt
  953.         Comms.Send txt+"\r"
  954.  
  955.         WaitForPrompt "PromptMain"
  956.     End If
  957. End Sub
  958.  
  959. 'T:SupportForum (subroutine) (CompuServe)
  960. Sub SupportForum(id As String, searchtype As String, prodname As String)
  961.     Dim fname As String
  962.  
  963.     ' Only search by one parameter
  964.     If Mid$(searchtype, 1, 1)<>"1" And Mid$(searchtype, 1, 1)<>"2" Then
  965.         LogResult "Support Forum Finder Failed due to invalid parameters."
  966.         Exit Sub
  967.     End If
  968.  
  969.     If Not GoForum("cis:support") Then
  970.         LogResult "Support Forum Finder Failed."
  971.         Exit Sub
  972.     End If
  973.  
  974.     ' Tell CIS what to search for
  975.     Comms.Send Mid$(searchtype, 1, 1)+"\r"
  976.     WaitFor ":  :"
  977.     Comms.SendLiteral prodname
  978.     Comms.Send "\r"
  979.     WaitFor "\r"
  980.  
  981.     ' Capture it
  982.     fname = StartCapture("Support/Forums CompuServe")
  983.     WaitForPrompt "PromptMain"
  984.     CaptureRewind 1
  985.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  986.     Capture CAPTURE_OFF
  987.     ResetForum
  988.  
  989.     ' Add to import queue
  990.     If QueueFile(Session.Service, fname, IM_DELETE) Then
  991.         ReportSuccess id & " : Search for " & prodname
  992.     End If
  993. End Sub
  994.  
  995. 'T:APOnline (subroutine) (CompuServe)
  996. Sub APOnline(id As String, subj As String)
  997.     Dim filename As String
  998.     Dim i As Integer
  999.     Dim section As String
  1000.     Dim t As Tracker, tErr As Tracker
  1001.  
  1002.     If Not GoForum("cis:apo-1") Then
  1003.         LogResult "Associated Press Online is not available; Please try later."
  1004.         Exit Sub
  1005.     End If
  1006.  
  1007.     filename = UniqueFilename$()
  1008.     Capture CAPTURE_ON, filename
  1009.     Terminal.CaptureStatus CAPTURE_ON
  1010.     Terminal.Enabled = False
  1011.     numpages = 0
  1012.     section = Mid(subj, InStr(subj, " ")+1)
  1013.     pseudo = "AP_Online/"+NoSpaces(section)+" Assoc_Press"
  1014.     If Mid(subj, 1, 2)="1 " Then
  1015.         Set t = CreateTracker("MessageStart", "\nAP Top News*E?T*\r", "PageSplitter", False, True)
  1016.     Else
  1017.         Set t = CreateTracker("MessageStart", "\nAP*E?T*\r", "PageSplitter", False, True)
  1018.     End If
  1019.     Set tErr = CreateTracker("PromptInvalid", "\n* is an invalid choice !", "", False, True)
  1020.  
  1021.     Comms.Send Mid(subj, 1, 2)+"\r"
  1022.     WaitForPrompt "PromptMain"
  1023.  
  1024.     If numpages = 0 Then
  1025.         i = 1
  1026.         Do
  1027.             Comms.Send Str$(i)+"\r"
  1028.             WaitFor Str$(i)+"\r"
  1029.             CaptureRewind 1+Len(Str$(i))
  1030.             Do
  1031.                 WaitForPrompt "Prompt"
  1032.             Loop Until PromptMatches("PromptMain") Or _
  1033.                        PromptMatches("PromptInvalid")
  1034.             i = i + 1
  1035.         Loop Until PromptMatches("PromptInvalid")
  1036.         CaptureRewind 24
  1037.     End If
  1038.  
  1039.     ' Clear up
  1040.     t.delete
  1041.     tErr.delete
  1042.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  1043.     Capture CAPTURE_OFF
  1044.     Terminal.CaptureStatus CAPTURE_OFF
  1045.     Terminal.Enabled = True
  1046.     Comms.Send "\r"
  1047.     WaitForPrompt "PromptMain"
  1048.  
  1049.     ' Add to import queue
  1050.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  1051.         ReportSuccess id & " : Search for " & subj & " in APOnline "
  1052.     End If
  1053.     GoTop
  1054. End Sub
  1055.  
  1056. 'T:SetupWizard (subroutine) (CompuServe)
  1057. Sub SetupWizard(mailname As String, organisation As String)
  1058.     WaitForPrompt "Prompt"
  1059.     SetupOptions ""
  1060. End Sub
  1061.  
  1062. 'T:CreateAccount (subroutine) (CompuServe)
  1063. Sub CreateAccount
  1064.     WaitFor "Choice :"
  1065.     Comms.Send "1\r"
  1066.     WaitFor "#:"
  1067.     Comms.Send "ASHMOUNT\r"
  1068.     WaitFor "#:"
  1069.     Comms.Send "93006\r"
  1070.     ManualTerminal
  1071. End Sub
  1072.  
  1073. Sub EditorLineNum(t as tracker)
  1074.     SetEditorToNO = True
  1075. End Sub
  1076.  
  1077. Sub PagedOutput(t as tracker)
  1078.     SetPagedOutputToNO = True
  1079. End Sub
  1080.  
  1081. 'T:AsciiUserLog (subroutine) (CompuServe)
  1082. Sub AsciiUserLog(id As String, forum As String)
  1083.     Dim filename As String
  1084.  
  1085.     If Not GoForum(forum) Then
  1086.         LogResult "Unable to access " + forum + " to get user log"
  1087.         Exit Sub
  1088.     End If
  1089.  
  1090.     filename = StartCapture(forum + "/Sysop_Logs User_Log")
  1091.     CaptureText "Who Accessed Forum"+Basic.Eoln$
  1092.     Terminal.Enabled=False
  1093.     Terminal.Status "Collecting forum user log ... Please wait"
  1094.     Comms.Send "ulog\r"
  1095.     WaitForPrompt "Prompt"
  1096.     CaptureRewind 7
  1097.     CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
  1098.     Capture CAPTURE_OFF
  1099.     Terminal.Enabled=True
  1100.     ' Add to import queue
  1101.     If QueueFile(Session.Service, filename, IM_DELETE) Then
  1102.         ReportSuccess id & " : User log collected from " & forum
  1103.     Else
  1104.         ReportSuccess id & " : User log for forum " & forum & " failed"
  1105.     End If
  1106. End Sub
  1107.  
  1108.