home *** CD-ROM | disk | FTP | other *** search
- 'T:EXEC.EBS for CompuServe
- ' VA 4.01 release
-
- Global Const IM_DELETE = 2048
-
- Declare Function UniqueFileName$
- Declare Function QueueFile(service As String, sfilename As String, queueflags As Long) As Boolean
- Declare Sub ReportSuccess(id As String)
- Declare Function StartCapture(pseudo As String)
- Declare Function WaitForEitherTimed(s1 As String, s2 As String, timeout As Integer) As String
- Declare Function GoForum(ByVal forum As String) As Boolean
- Declare Sub ResetForum
-
- Dim CisError As Boolean
-
- 'T:CreateExecTrackers (subroutine) (CompuServe)
- Sub CreateExecTrackers
- Dim t As Tracker
-
- ' Special for Financial & Exec stuff
- Set t = CreateTracker("PromptIssue1", "\n\rIssue:")
- Set t = CreateTracker("PromptIssue2", "\nIssue:")
- Set t = CreateTracker("PromptIssueError", "\nPress <CR> to continue !")
- Set t = CreateTracker("PromptCommodity1", "\n\rCommodity:")
- Set t = CreateTracker("PromptCommodity2", "\nCommodity:")
- Set t = CreateTracker("PromptCompany1", "\n\rCompany:")
- Set t = CreateTracker("PromptCompany2", "\nCompany:")
- End Sub
-
- 'T:DestroyExecTrackers (subroutine) (CompuServe)
- Sub DestroyExecTrackers
- Dim t As Tracker
-
- ' Special for Financial & Exec stuff
- Trackers("PromptIssue1").delete
- Trackers("PromptIssue2").delete
- Trackers("PromptIssueError").delete
- Trackers("PromptCommodity1").delete
- Trackers("PromptCommodity2").delete
- Trackers("PromptCompany1").delete
- Trackers("PromptCompany2").delete
- End Sub
-
- 'T:CisErrorProc (subroutine) (CompuServe)
- ' Called when CIS puts up a \n% error
- Sub CisErrorProc(t As Tracker)
- CisError = True
- t.reset
- End Sub
-
- 'T:GeneralIssue (subroutine) (CompuServe)
- Sub GeneralIssue(id As String, forum As String, pseudo As String, ticker As String)
- Dim filename As String
-
- ' Go to main page
- If Not GoForum(forum) Then
- LogResult "Failed trying to GO "+forum
- Exit Sub
- End If
- ResetForum
- CreateExecTrackers
-
- ' Start capturing
- filename = StartCapture("Stocks/"+pseudo)
- CaptureText "Ticker:"
-
- ' Send the command
- Terminal.Status "Collecting Information ... Please Wait"
- Terminal.Enabled=False
- Comms.Send ticker+"\r"
-
- ' Get all messages
- WaitForPrompt "PromptIssue"
- CaptureRewind 7
- CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
-
- ' Clean up
- Capture CAPTURE_OFF
- Comms.Send "\r"
- WaitForPrompt "Prompt"
- Terminal.Enabled=True
-
- ' Add to import queue
- If QueueFile(Session.Service, filename, IM_DELETE) Then
- ReportSuccess id & " : Collect stock information about " & ticker & " "
- End If
- DestroyExecTrackers
- End Sub
-
- 'T:SingleStock (subroutine) (CompuServe)
- Sub SingleStock(id As String, ticker As String)
- GeneralIssue id, "cis:basicquotes", "Quotes CompuServe", ticker
- End Sub
-
- 'T:GlobalStock (subroutine) (CompuServe)
- Sub GlobalStock(id As String, ticker As String)
- GeneralIssue id, "cis:rcq-5", "Quotes CompuServe", ticker
- End Sub
-
- 'T:ExchangeRates (subroutine) (CompuServe)
- Sub ExchangeRates(id As String)
- GeneralIssue id, "cis:basicquotes", "Exchange_Rates CompuServe", _
- "XRAD,XRBP,XRCD,XRFF,XRGM,XRJY,XRSF"
- End Sub
-
- 'T:SendSedol (subroutine) (CompuServe)
- ' Sends a sedol symbol to CIS
- Sub SendSedol(sedol As String)
- ' Supports the following formats:
- ' "S:<sedol>", "*<company>" or "<sedol>"
- If Mid(sedol, 1, 1)="*" Or UCase(Mid(Sedol, 1, 1))="S" Then
- Comms.Send sedol+"\r" ' Allow searching of SEDOLs
- Else
- Comms.Send "S:"+sedol+"\r"
- End If
- End Sub
-
- 'T:UKPrice (subroutine) (CompuServe)
- Sub UKPrice(id As String, sedol As String, period As String, start As String, enddate As String)
- Dim filename As String
- Dim failed As Boolean
- Dim t As Tracker
-
- ' Validate parameters
- period = UCase(Mid(period, 1, 1))
- If Not InStr("DWM", period) Then period = "D"
-
- ' Go to main page
- If Not GoForum("cis:efs-13") Then
- LogResult "Failed trying to GO EFS-13"
- Exit Sub
- End If
- ResetForum
- CreateExecTrackers
-
- CisError = False
- Set t = CreateTracker("CisError", "\n%*\r", "CisErrorProc", False, True)
-
- ' Send the command
- SendSedol sedol
- WaitFor sedol+"\r"
-
- ' Start capturing
- failed = False
- filename = StartCapture("Stocks/UK_Price CompuServe")
- CaptureText "Sedol:"+sedol+" Start:"+start+" End:"+enddate+Basic.Eoln$
- If WaitForEitherTimed("onthly? :", "\n!", 100)="\n!" Then
- CaptureRewind 1
- Else
- Comms.Send period+"\r"
- WaitFor "date?"
- Comms.Send start+"\r"
- If WaitForEitherTimed("\?", "\n!", 100)="\n!" Then
- failed = True
- CaptureRewind 1
- Else
- If CisError Then
- CaptureRewind 7
- Else
- Comms.Send enddate+"\r"
- ' Wait for results
- CaptureRewind Len(WaitForEitherTimed("\n!", "Name:", 100))
- End If
- End If
- End If
- CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
-
- ' Clean up
- t.delete
- Capture CAPTURE_OFF
- If failed Then
- GoTop
- Else
- Comms.Send "\r"
- WaitForPrompt "Prompt"
- Comms.Send "\r"
- WaitForPrompt "Prompt"
- End If
-
- ' Add to import queue
- If QueueFile(Session.Service, filename, IM_DELETE) Then
- ReportSuccess id & " : Collect stock information about " & sedol & " "
- End If
- DestroyExecTrackers
- End Sub
-
- 'T:SedolCompanyTicker (subroutine) (CompuServe)
- Sub SedolCompanyTicker(id As String, mnu As String, cname As String)
- Dim filename As String
-
- ' Go to main page
- If Not GoForum("cis:efs-14") Then
- LogResult "Failed trying to GO EFS-14"
- Exit Sub
- End If
- ResetForum
- CreateExecTrackers
-
- ' Send the command
- If mnu="2" Then
- Comms.Send "2\r" 'Ticker
- WaitFor "Symbol:"
- Else
- Comms.Send "1\r" 'Company
- WaitFor "Name:"
- End If
- Comms.Send cname+"\r"
- WaitFor cname
-
- ' Start capturing
- filename = StartCapture("Stocks/UK_Price CompuServe")
- CaptureText cname+Basic.Eoln$
- If mnu="2" Then
- CaptureRewind Len(WaitForEitherTimed("!", "Symbol:", 60))
- Else
- CaptureRewind Len(WaitForEitherTimed("!", "Name:", 60))
- End If
- CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
-
- ' Clean up
- Capture CAPTURE_OFF
- Comms.Send "\r"
- WaitForPrompt "Prompt"
- GoTop
-
- ' Add to import queue
- If QueueFile(Session.Service, filename, IM_DELETE) Then
- ReportSuccess id & " : Collect stock information about " & cname & " "
- End If
- DestroyExecTrackers
- End Sub
-
- 'T:UKLatest (subroutine) (CompuServe)
- Sub UKLatest(id As String, sedol As String, period As String, num As String)
- UKPrice id, sedol, period, num, ""
- End Sub
-
- 'T:GeneralCommodity (subroutine) (CompuServe)
- Sub GeneralCommodity(id As String, start As String, enddate As String, period As String, symword As String)
- Dim filename As String
-
- ' Make sure it's valid
- period = UCase(Mid(period, 1, 1))
- If Not InStr("DWM", period) Then period = "D"
-
- ' Go to main page
- If Not GoForum("cis:cprice") Then
- LogResult "Failed trying to GO CPRICE"
- Exit Sub
- End If
- ResetForum
- CreateExecTrackers
-
- ' Send the command
- Comms.Send "/date\r"
- WaitFor "\? :"
- Comms.Send period+"\r"
- WaitFor "\?"
- Comms.Send start+"\r"
- WaitFor "\?"
- Comms.Send enddate+"\r"
- WaitForPrompt "PromptCommodity"
- Comms.Send symword+"\r"
-
- ' Start capturing
- filename = StartCapture("Stocks/Commodities CompuServe")
-
- If WaitForEitherTimed("!", ":", 60)="!" Then
- Comms.Send "1\r"
- WaitFor "1\r"
- WaitFor "!"
- End If
- CaptureRewind 1
- CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
-
- ' Clean up
- Capture CAPTURE_OFF
- Comms.Send "\r\r"
- WaitForPrompt "Prompt"
- GoTop
-
- ' Add to import queue
- If QueueFile(Session.Service, filename, IM_DELETE) Then
- ReportSuccess id & " : Collect stock information about " & symword & " "
- End If
- DestroyExecTrackers
- End Sub
-
- 'T:SingleCommodity (subroutine) (CompuServe)
- Sub SingleCommodity(id As String, start As String, symdate As String)
- GeneralCommodity id, start, "", "d", symdate
- End Sub
-
- 'T:BasicCompany (subroutine) (CompuServe)
- Sub BasicCompany(id As String, ticker As String)
- Dim filename As String
- Dim t As Tracker
-
- ' Go to main page
- If Not GoForum("cis:bdi-1") Then
- LogResult "Failed trying to GO BDI-1"
- Exit Sub
- End If
- ResetForum
- CreateExecTrackers
-
- ' Install handler to trap potential problem
- Set t = CreateTracker("PromptExtra", "1 List companies found")
-
- ' Send the command
-
- Comms.Send ticker+"\r"
-
- ' Start capturing
- filename = StartCapture("Stocks/Company_Info CompuServe")
- CaptureText "Company:"
- Terminal.Status "Collecting Information ... Please Wait"
- Terminal.Enabled=False
- WaitForPrompt "Prompt"
- If PromptMatches("PromptExtra") Then
- WaitForPrompt "PromptMain"
- Comms.Send "1\r"
- WaitForPrompt "PromptMain"
- End If
- t.delete
- CaptureRewind 1
- CaptureText Basic.Eoln$+"!end"+Basic.Eoln$
-
- ' Clean up
- Capture CAPTURE_OFF
- Terminal.Enabled=True
-
-
- ' Add to import queue
- If QueueFile(Session.Service, filename, IM_DELETE) Then
- ReportSuccess id & " : Collect information about " & ticker & " "
- End If
- DestroyExecTrackers
- End Sub
-
-
-