onedayillpay Posted July 5, 2008 Posted July 5, 2008 this used to work like a charm... i use this to log ip address that connect on port 6112... some thing is wrong with i think stringsplit?!?!? or is it that im on vista?!?!? $netstat = Run("netstat -n", @WorkingDir, @SW_HIDE,7) $aRecords = StringSplit(StringStripCR(StdoutRead($netstat)), @LF) $file = FileRead('test.txt') MsgBox(0,"$aRecords",$aRecords) For $x = 1 To $aRecords[0] If StringInStr($aRecords[$x], '6112') And Not StringInStr($file, $aRecords[$x]) Then FileWriteLine('test.txt', $aRecords[$x]) Next
monoceres Posted July 5, 2008 Posted July 5, 2008 Hi! The problem is StdoutRead(), the behavior of this function changed recently (it no longer blocks). Please refer to help file for info on how to use it. Good luck! muttley Broken link? PM me and I'll send you the file!
onedayillpay Posted July 7, 2008 Author Posted July 7, 2008 Im stumped muttley Is there another way i could retrieve data from netstat ???
martin Posted July 7, 2008 Posted July 7, 2008 (edited) Im stumped muttley Is there another way i could retrieve data from netstat ???#include <Constants.au3> ;$foo = Run("cmd.exe", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) ;StdinWrite($foo, "netstat" & @CRLF) $foo = Run("netstat.exe", @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo) ; Read from child's STDOUT Local $data While True $data &= StdoutRead($foo) If @error Then ExitLoop Sleep(25) WEnd MsgBox(262144,'Netstat output',$data) But that can be obtained by reading the help. Edited July 7, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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