Sign in to follow this  
Followers 0
potitpanda

Help Portion of code is not working on Autoit V3.2.12.0

3 posts in this topic

Hi

I have this code and it's still not working on V3.2.12.0 Why

CODE :

#include <Constants.au3>

;Récupere le nom et l'IP du S1

$process_id = Run(@ComSpec & " /c nslookup.exe 127.0.0.1 ","", @SW_HIDE,$STDOUT_CHILD)

$line = StdoutRead($process_id)

if StringLen($line)>11 then

$myarray = StringRegExp(StringLower($line),".*(w-013[0-9]{4}[a-z]-).*", 1)

if (StringLen($myarray[0]) >10) then

$S1_name=$myarray[0]&"1"

; Msgbox (0,"test",$s1_name)

EndIf

endif

$process_id = Run(@ComSpec & " /c nslookup.exe "& $s1_name ,"", @SW_HIDE,$STDOUT_CHILD)

$line = StdoutRead($process_id)

if StringLen($line)>11 then

$myarray = StringRegExp(StringLower($line),"172.*.*.162",1)

if (StringLen($myarray[0]) >5) then

$S1_ip=$myarray[0]

;Msgbox (0,"test",$s1_ip)

EndIf

endif

With AU V3.2.10.0 this code works

Thanks for the replies

PotitPanda

Share this post


Link to post
Share on other sites



Try this:

#include <Constants.au3>

Global $myarray
Dim $line

;Recupere le nom et l'IP du S1
$process_id = Run(@ComSpec & " /c nslookup.exe", "", @SW_HIDE, $STDOUT_CHILD)

While 1
    $line &= StdoutRead($process_id)
    If @error Then ExitLoop
WEnd

ConsoleWrite($line & @LF)

If StringLen($line) > 11 Then $myarray = StringRegExp(StringLower($line), ".*(w-013[0-9]{4}[a-z]-).*", 1)
If @error Then Exit

If (StringLen($myarray[0]) >10) Then
    $S1_name=$myarray[0] & "1"
    Msgbox (0, "test", $s1_name)
EndIf

$line = ""

$process_id = Run(@ComSpec & " /c nslookup.exe " & $s1_name , "", @SW_HIDE, $STDOUT_CHILD)

While 1
    $line &= StdoutRead($process_id)
    If @error Then ExitLoop
WEnd

If StringLen($line)>11 Then
    $myarray = StringRegExp(StringLower($line),"172.*.*.162",1)
    If @error Then Exit
    If (StringLen($myarray[0]) >5) Then
        $S1_ip=$myarray[0]
    EndIf
Endif

Share this post


Link to post
Share on other sites

Works Fine

Thanks

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