w0uter Posted June 4, 2005 Share Posted June 4, 2005 got boored. again. wanted to figure out std func's. made this. Func _NetStat() Local $v_NETSTAT $v_NETSTAT = Run(@SystemDir & '\netstat.exe', @SystemDir, @SW_HIDE, 2) $v_NETSTAT = StdoutRead ($v_NETSTAT) $v_NETSTAT = StringTrimLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, 4)) $v_NETSTAT = StringLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, -1) - 1) $v_NETSTAT = StringSplit($v_NETSTAT, @LF) Local $as_Temp, $as_RET[$v_NETSTAT[0]][4] For $i = 1 To $v_NETSTAT[0] $v_NETSTAT[$i] = StringReplace($v_NETSTAT[$i], @CR, '') $v_NETSTAT[$i] = StringStripWS($v_NETSTAT[$i], 1 + 2 + 4) $as_Temp = StringSplit($v_NETSTAT[$i], ' ') $as_RET[$i - 1][0] = $as_Temp[1] $as_RET[$i - 1][1] = $as_Temp[2] $as_RET[$i - 1][2] = $as_Temp[3] $as_RET[$i - 1][3] = $as_Temp[4] Next Return $as_RET EndFunc ;==>_NetStat dim $v_lol = _NetStat() For $i = 0 To UBound($v_lol) - 1 For $x = 0 To 3 ConsoleWrite('-' & $v_lol[$i][$x] & @LF) Next ConsoleWrite(@LF) Next_NetStat.au3 My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
UltraFine Posted November 10, 2008 Share Posted November 10, 2008 got boored. again. wanted to figure out std func's. made this. Func _NetStat() Local $v_NETSTAT $v_NETSTAT = Run(@SystemDir & '\netstat.exe', @SystemDir, @SW_HIDE, 2) $v_NETSTAT = StdoutRead ($v_NETSTAT) $v_NETSTAT = StringTrimLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, 4)) $v_NETSTAT = StringLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, -1) - 1) $v_NETSTAT = StringSplit($v_NETSTAT, @LF) Local $as_Temp, $as_RET[$v_NETSTAT[0]][4] For $i = 1 To $v_NETSTAT[0] $v_NETSTAT[$i] = StringReplace($v_NETSTAT[$i], @CR, '') $v_NETSTAT[$i] = StringStripWS($v_NETSTAT[$i], 1 + 2 + 4) $as_Temp = StringSplit($v_NETSTAT[$i], ' ') $as_RET[$i - 1][0] = $as_Temp[1] $as_RET[$i - 1][1] = $as_Temp[2] $as_RET[$i - 1][2] = $as_Temp[3] $as_RET[$i - 1][3] = $as_Temp[4] Next Return $as_RET EndFunc ;==>_NetStat dim $v_lol = _NetStat() For $i = 0 To UBound($v_lol) - 1 For $x = 0 To 3 ConsoleWrite('-' & $v_lol[$i][$x] & @LF) Next ConsoleWrite(@LF) Nextsorry for the bump, but it really helped me. thanks for sharing it. Link to comment Share on other sites More sharing options...
UltraFine Posted November 10, 2008 Share Posted November 10, 2008 F:\Documents and Settings\Admin\Desktop\_NetStats.au3 (20) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:$as_RET[$i - 1][1] = $as_Temp[2]$as_RET[$i - 1][1] = ^ ERROR>Exit code: 1 Time: 1.009how to resolve this error? Link to comment Share on other sites More sharing options...
Robjong Posted November 10, 2008 Share Posted November 10, 2008 (edited) Func _NetStat() Local $v_NETSTAT $v_NETSTAT = Run(@SystemDir & '\netstat.exe', @SystemDir, @SW_HIDE, 2) $v_NETSTAT = StdoutRead($v_NETSTAT) $v_NETSTAT = StringTrimLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, 4)) $v_NETSTAT = StringLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, -1) - 1) $v_NETSTAT = StringSplit($v_NETSTAT, @LF) Local $as_Temp, $as_RET[$v_NETSTAT[0]][4] For $i = 1 To $v_NETSTAT[0] $v_NETSTAT[$i] = StringReplace($v_NETSTAT[$i], @CR, '') $v_NETSTAT[$i] = StringStripWS($v_NETSTAT[$i], 1 + 2 + 4) $as_Temp = StringSplit($v_NETSTAT[$i], ' ') If UBound($as_Temp) > 1 Then $as_RET[$i - 1][0] = $as_Temp[1] If UBound($as_Temp) > 2 Then $as_RET[$i - 1][1] = $as_Temp[2] If UBound($as_Temp) > 3 Then $as_RET[$i - 1][2] = $as_Temp[3] If UBound($as_Temp) > 4 Then $as_RET[$i - 1][3] = $as_Temp[4] Next Return $as_RET EndFunc ;==>_NetStat Edited November 10, 2008 by Robjong Link to comment Share on other sites More sharing options...
SoulA Posted November 10, 2008 Share Posted November 10, 2008 (edited) I like this one too... expandcollapse popup#include <Array.au3> #include <Process.au3> dim $v_lol = _NetStat() _ArrayDisplay($v_lol) Func _NetStat() Local $v_NETSTAT = "" $pid_NETSTAT = Run(@SystemDir & '\netstat.exe -a -o', @SystemDir, @SW_HIDE, 2) While ProcessExists($pid_NETSTAT) $v_NETSTAT &= StdoutRead($pid_NETSTAT) WEnd $v_NETSTAT = StringTrimLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, 4)) $v_NETSTAT = StringLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, -1) - 1) $v_NETSTAT = StringSplit($v_NETSTAT, @LF) Local $as_Temp, $as_RET[$v_NETSTAT[0] + 1][6] $as_RET[0][0] = $v_NETSTAT[0] For $i = 1 To $v_NETSTAT[0] $v_NETSTAT[$i] = StringReplace($v_NETSTAT[$i], @CR, '') $v_NETSTAT[$i] = StringStripWS($v_NETSTAT[$i], 1 + 2 + 4) $as_Temp = StringSplit($v_NETSTAT[$i], ' ') If $as_Temp[1] = "TCP" Then $as_RET[$i][0] = $as_Temp[1] $as_RET[$i][1] = $as_Temp[2] $as_RET[$i][2] = $as_Temp[3] $as_RET[$i][3] = $as_Temp[4] $as_RET[$i][4] = $as_Temp[5] $as_RET[$i][5] = _ProcessGetName($as_Temp[5]) EndIf If $as_Temp[1] = "UDP" Then $as_RET[$i][0] = $as_Temp[1] $as_RET[$i][1] = $as_Temp[2] $as_RET[$i][2] = $as_Temp[3] $as_RET[$i][3] = "*:*" $as_RET[$i][4] = $as_Temp[4] $as_RET[$i][5] = _ProcessGetName($as_Temp[4]) EndIf Next Return $as_RET EndFunc ;==>_NetStat Edited November 10, 2008 by SoulA Link to comment Share on other sites More sharing options...
JRowe Posted November 10, 2008 Share Posted November 10, 2008 $as_RET[$i - 1][3] = "*" Aw, I think UDP has a crush on somebody. Code tags prevent that from happening, for future reference expandcollapse popup#include <Array.au3> #include <Process.au3> dim $v_lol = _NetStat() _ArrayDisplay($v_lol) Func _NetStat() Local $v_NETSTAT = "" $pid_NETSTAT = Run(@SystemDir & '\netstat.exe -a -o', @SystemDir, @SW_HIDE, 2) While ProcessExists($pid_NETSTAT) $v_NETSTAT &= StdoutRead($pid_NETSTAT) WEnd $v_NETSTAT = StringTrimLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, 4)) $v_NETSTAT = StringLeft($v_NETSTAT, StringInStr($v_NETSTAT, @LF, 0, -1) - 1) $v_NETSTAT = StringSplit($v_NETSTAT, @LF) Local $as_Temp, $as_RET[$v_NETSTAT[0]][6] For $i = 1 To $v_NETSTAT[0] $v_NETSTAT[$i] = StringReplace($v_NETSTAT[$i], @CR, '') $v_NETSTAT[$i] = StringStripWS($v_NETSTAT[$i], 1 + 2 + 4) $as_Temp = StringSplit($v_NETSTAT[$i], ' ') If $as_Temp[1] = "TCP" Then $as_RET[$i - 1][0] = $as_Temp[1] $as_RET[$i - 1][1] = $as_Temp[2] $as_RET[$i - 1][2] = $as_Temp[3] $as_RET[$i - 1][3] = $as_Temp[4] $as_RET[$i - 1][4] = $as_Temp[5] $as_RET[$i - 1][5] = _ProcessGetName($as_Temp[5]) EndIf If $as_Temp[1] = "UDP" Then $as_RET[$i - 1][0] = $as_Temp[1] $as_RET[$i - 1][1] = $as_Temp[2] $as_RET[$i - 1][2] = $as_Temp[3] $as_RET[$i - 1][3] = "*:*" $as_RET[$i - 1][4] = $as_Temp[4] $as_RET[$i - 1][5] = _ProcessGetName($as_Temp[4]) EndIf Next Return $as_RET EndFunc ;==>_NetStat [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
SoulA Posted November 10, 2008 Share Posted November 10, 2008 screw that its cute. Link to comment Share on other sites More sharing options...
arekkusu82 Posted November 21, 2008 Share Posted November 21, 2008 screw that its cute.Yeahh..... No. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now