Jump to content

Qestion regarding netstat


Recommended Posts

Ok, I'm haveing trouble fiquereing out how to write this the correct way. heres the code I'm working with take a look and tell me what you think.

WinSetState("Diablo II", "", @SW_HIDE) ;minimize game
Sleep(2000)
WinSetState("C:\WINDOWS\system32\cmd.exe", "", @SW_SHOW); opens cmd
WinActivate("C:\WINDOWS\system32\cmd.exe", "")
Sleep(1000)
Send("_netstat")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
FileOpen("Netstat", 2)
FileWriteLine("Netstat", "")               <------ this is where im haveing trouble(not sure what to add to get the correct line to write, 40000)
WinSetState("C:\WINDOWS\system32\cmd.exe", "", @SW_HIDE)
Sleep(2000)
WinSetState("Diablo II", "", @SW_SHOW)
WinActivate("Diablo II", "")
Sleep(2000)
;Do actions, else

Not sure what to do. I just want it to write the line of the :4000 string.

Any one know what to do?

I searched the help files and searched on the forums. I've found some examples. But not done in the way I need.

Thank you in advance for your time!

Link to comment
Share on other sites

Is Netstat a text file?

Do Not Steal The Government Hates CompetitionO2JAM AutoPlayBot [|||||.............] 10%Friendster Commenter [..................] 0%Auto Message Download Percentage [|||||||||||||||||] 100%
Link to comment
Share on other sites

Where you see port ":80 " - change that to ":4000 "

#include <string.au3>

$PID = Run("netstat -n", @SystemDir, @SW_HIDE, 2)
Local $Out, $IParray

While 1
    $Out &= StdoutRead($PID)
    If @error Then ExitLoop
WEnd

$OutArray = StringSplit($Out, @CR)

For $i = 1 To $OutArray[0]
    If StringInStr($OutArray[$i], ":80 ", 1) Then
        MsgBox(0, $i & " of " & $OutArray[0], $OutArray[$i], 3)
        $IParray = _StringBetween($OutArray[$i], ":", ":")
        MsgBox(0, $i & " of " & $OutArray[0], ">>>" & _
                StringTrimLeft($IParray[0], 9) & "<<<", 3)
    EndIf
Next
This code is from something else.

I'll let the gamers help you with putting it in a file if you really think that you want it there.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Where you see port ":80 " - change that to ":4000 "

#include <string.au3>

$PID = Run("netstat -n", @SystemDir, @SW_HIDE, 2)
Local $Out, $IParray

While 1
    $Out &= StdoutRead($PID)
    If @error Then ExitLoop
WEnd

$OutArray = StringSplit($Out, @CR)

For $i = 1 To $OutArray[0]
    If StringInStr($OutArray[$i], ":80 ", 1) Then
        MsgBox(0, $i & " of " & $OutArray[0], $OutArray[$i], 3)
        $IParray = _StringBetween($OutArray[$i], ":", ":")
        MsgBox(0, $i & " of " & $OutArray[0], ">>>" & _
                StringTrimLeft($IParray[0], 9) & "<<<", 3)
    EndIf
Next
This code is from something else.

I'll let the gamers help you with putting it in a file if you really think that you want it there.

This works great (thank you by the way, so great I rewrote my code to use yours instead lol) but when I try to write it back to the character screen it gives me nothing.

FileOpen("Netstat.txt", 2)
FileWriteLine("Netstat.txt","Netstat=" & $OutArray[$i])
FileClose("Netstat.txt")
    EndIf
Next
Sleep(2000)
    WinSetState("Diablo II", "", @SW_SHOW)
    WinActivate("Diablo II", "")
    Sleep(4000)
    FileReadLine("Netstat", 2)
Send("{ENTER}")
Sleep(5000)
Send($Netstat,"")
Send("{ENTER}")
Sleep(5000)

I cant find in the help files where to only write the line in the file to the diablo screen. I know I'm missing something, and its probably something simple. can some one point me in the right direction on this.

Edited by XxxKills
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...