Jump to content

VB script to Auto-IT question.


 Share

Recommended Posts

does anyone know if the following VB lines are supported by AutoIT in some sort of a way:

I am using socket.dll for the connection.

Set w3sock = CreateObject("socket.tcp")

With w3sock

.DoTelnetEmulation = True

.TelnetEmulation = "TTY"

.Host = "9.148.218.20:23"

.Open

.WaitFor "login:"

.SendLine "ibm"

.WaitFor "Password"

.SendLine "ibm4isr"

autoitcode: does create the session, but the waitfor login is not working.

$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.WaitFor = "BCMS"
$oIE.Close
$oIE=0

I also tried without the "="

Edited by erezlevi
Link to comment
Share on other sites

Maybe...

$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.WaitFor("BCMS")

$oIE.Close()

$oIE=0

Link to comment
Share on other sites

Maybe...

$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.WaitFor("BCMS")

$oIE.Close()

$oIE=0

I tried it, but I tried this also and it does not work:

$oIE = ObjCreate("socket.tcp")
With $oIE
    .DoTelnetEmulation = True
    .TelnetEmulation = "TTY"
    .Host = "9.148.218.20:23"
    .Open
    .WaitFor "login:"
    .SendLine "ibm"
    .WaitFor "Password"
    .SendLine "ibm4isr"
    .WaitFor "System:"
    .SendLine "w2ktt"
    .WaitFor "Command:"
    .SendLine "list bcms skill 107"
    .WaitFor "BCMS"
    $s = .Buffer
    .SendLine Chr(27) & "n"
    .WaitFor "BCMS"
    .Close
EndWith
$oIE = 0
Link to comment
Share on other sites

Maybe this needs parentheses as well:

$oIE.DoTelnetEmulation(True)

That With statement should work but you can't sneak any other assignments inside of it:

$oIE = ObjCreate("socket.tcp")

With $oIE

.DoTelnetEmulation = True

.TelnetEmulation = "TTY"

.Host = "9.148.218.20:23"

.Open

.WaitFor "login:"

.SendLine "ibm"

.WaitFor "Password"

.SendLine "ibm4isr"

.WaitFor "System:"

.SendLine "w2ktt"

.WaitFor "Command:"

.SendLine "list bcms skill 107"

.WaitFor "BCMS"

$s = .Buffer

.SendLine Chr(27) & "n"

.WaitFor "BCMS"

.Close

EndWith

$oIE = 0

You would have to split this into 2 With statements. I'm pretty sure you have to call a lot of these as functions and not as assignments though.

Link to comment
Share on other sites

Maybe this needs parentheses as well:

$oIE.DoTelnetEmulation(True)

That With statement should work but you can't sneak any other assignments inside of it:

$oIE = ObjCreate("socket.tcp")

With $oIE

.DoTelnetEmulation = True

.TelnetEmulation = "TTY"

.Host = "9.148.218.20:23"

.Open

.WaitFor "login:"

.SendLine "ibm"

.WaitFor "Password"

.SendLine "ibm4isr"

.WaitFor "System:"

.SendLine "w2ktt"

.WaitFor "Command:"

.SendLine "list bcms skill 107"

.WaitFor "BCMS"

$s = .Buffer

.SendLine Chr(27) & "n"

.WaitFor "BCMS"

.Close

EndWith

$oIE = 0

You would have to split this into 2 With statements. I'm pretty sure you have to call a lot of these as functions and not as assignments though.

well got it working:

$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")
$s1=$oIE.Buffer
$oIE.WaitFor("BCMS")
$s=$oIE.Buffer
$oIE.SendLine(Chr(27) & "n")
$p=$oIE.Buffer
$oIE.WaitFor("BCMS")
$z=$oIE.Buffer
$z1=$oIE.Buffer
$z2=$oIE.Buffer
$z3=$oIE.Buffer
$oIE.Close()
$oIE=0
MsgBox (0,"this is $s",$s1 & @CRLF & $s & @CRLF & $p & @CRLF & $z & @CRLF & $z1 &  @CRLF & $z2 &  @CRLF & $z3)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...