Sign in to follow this  
Followers 0
erezlevi

VB script ---> AutoIT help again.

8 posts in this topic

Hi,

how can I enlarge the buffer size here? in VB the .buffer = 2048 bytes. but in AutoIT it is only 378. ($s=$oIE.Buffer)

Can anyone help here?

autoit code:

#include <Array.au3>
#include <String.au3>
Local $E[500]

$oIE=ObjCreate ("socket.tcp")
$oIE.DoTelnetEmulation = True
$oIE.TelnetEmulation ="TTY"
$oIE.Host = "9.148.218.20:23"
$oIE.Open()
$oIE.WaitFor("login:")
$oIE.SendLine("ibm")
$oIE.WaitFor("Password")
$oIE.SendLine("ibm4isr")
$oIE.WaitFor("System:")
$oIE.SendLine("w2ktt")
$oIE.WaitFor("Command:")
$oIE.SendLine("list bcms skill 107")
$oIE.WaitFor("BCMS")
$s=$oIE.Buffer
$oIE.SendLine(Chr(27) & "n")
$oIE.Close()
$oIE=0
$E[1]=$s

$m=string($s)
MsgBox (0,"string lenght:",StringLen ($m))
for $i=1 to StringLen ($s)
$p1=StringInStr($m,Chr(27))
$p2=StringInStr($m,"H")
$p3=($p2-$p1)+1
$p4=StringMid ($m,$p1,$p3)
MsgBox (0,"$m before",$m)
$m=StringReplace ($m,$p4," ")
MsgBox (0,"$m after",$m)
Next
FileOpen ("c:\erez.txt",2)
FileWrite ("c:\erez.txt",$m)

VB code:

Option Explicit
Dim w3sock As Socket.TCP
'Dim scr As FileSystemObject

Private Sub Command1_Click()
Set w3sock = CreateObject("socket.tcp")
'Set fs = New FileSystemObject
'set f =
With w3sock
    .DoTelnetEmulation = True
    .TelnetEmulation = "TTY"
    .Host = "9.148.218.20:23"
    .Open
    
    .WaitFor "login:"
    .SendLine "ibm"
    .SendLine "ibm4isr"
    

.WaitFor "System:"
.SendLine "w2ktt"
.WaitFor "Command:"
'.SendLine "~"
's = .GetText(2)
'MsgBox .Buffer
'.WaitFor "Command:"
'MsgBox .Buffer
.SendLine "list bcms skill 107"
'MsgBox .Buffer
'.SendLine "{ESC}" & "x"
.WaitFor "BCMS"
'MsgBox .Buffer
Debug.Print Len(.Buffer)
'Debug.Print .Buffer
Dim i As Long
Dim s As String
s = .Buffer
Debug.Print Len(.Buffer)
For i = 1 To 40
    Debug.Print Mid(s, i, 1) & "=" & Asc(Mid(s, i, 1))
Next
For i = 1 To Len(.Buffer)
    If InStr(InStr(1, s, Chr(27)), s, "H") = 0 Then Exit For
    s = Replace(s, Mid(s, InStr(1, s, Chr(27)), InStr(InStr(1, s, Chr(27)), s, "H") - InStr(1, s, Chr(27)) + 1), " ", 1)
Next
Debug.Print s
  
.SendLine Chr(27)
.SendLine "n"
.WaitFor "BCMS"

For i = 1 To Len(.Buffer)
    If InStr(InStr(1, s, Chr(27)), s, "H") = 0 Then Exit For
    s = Replace(s, Mid(s, InStr(1, s, Chr(27)), InStr(InStr(1, s, Chr(27)), s, "H") - InStr(1, s, Chr(27)) + 1), " ", 1)
Next
Debug.Print s

    .Close
End With
Set w3sock = Nothing
End Sub

Share this post


Link to post
Share on other sites



bump.

Share this post


Link to post
Share on other sites

Whats the "Socket.tcp" from?

regsvr32 %WINDIR%\system32\Socket.dll

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Crap. I don't have it. Well there goes that idea of seeing whats wrong. Maybe its time to wait for the COM god? :D

here.

don't forget to register it before using it.

Share this post


Link to post
Share on other sites

Crap. I don't have it. Well there goes that idea of seeing whats wrong. Maybe its time to wait for the COM god? :D

here.

don't forget to register it before using it.

Share this post


Link to post
Share on other sites

bump.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0