Sign in to follow this  
Followers 0
onedayillpay

Array - - - help

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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!

Share this post


Link to post
Share on other sites

Im stumped muttley Is there another way i could retrieve data from netstat ???

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 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.

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