View Single Post
  #7  
Old 03-29-2019, 09:49 AM
Reno Reno is offline
Registered User
 
Join Date: Mar 2019
Posts: 34
bgagnon,

I realized last night that I was looking at this wrong. I was thinking, that after the prompt returns, I should be scanning the screen by x/y positions to find what I need and grab it. Then it occurred to me, that what I should really be trying to do, would be capturing each line as it goes by into an array of CRT lines so that I could then leverage the VBscript array functions to search for the information I need inside the array.

I did a search on the forums with that new idea and found and example that was exactly what I needed to get started (from VanDyke/Mike). I just need to modify Mike's example script to add an array and then re-dim it for each new line, adding the new line to the new array position.

https://forums.vandyke.com/showthread.php?t=2147


Code:
#$language = "VBScript"
#$interface = "1.0"

crt.screen.synchronous = TRUE

Dim szOutput, szFinishedOutput, szCommand, szPrompt, nResult

Dim szStringArray

nIndex = 1
szOutput = ""
szCommand = "ls -1"
szPrompt = " $"

crt.screen.send szCommand & vbcr
nResult = crt.screen.waitforstrings(vbcr, vblf, 5)
szOutput = szOutput & crt.screen.readstring()

do
    szOutput = szOutput & crt.screen.readstring()
    if InStr(1, szOutput, szPrompt, 1) > 0 then exit do
loop

szStringArray = Split(szOutput, vbcr, -1, 1)

msgbox "Finished running command and collecting data..." & vbcr & _
        szOutput

Last edited by Reno; 03-29-2019 at 09:55 AM.
Reply With Quote