PowNoob Posted August 30, 2010 Share Posted August 30, 2010 i did pixelgetcolor before and is not working like i wanted it.. this time i want to manage by IP since the program is connected online. I found this script and it worked great by pulling the IP address. What i want to do is compare the ip address for example if outlook ip 192.168.1.1 = 192.168.1.1 then blank else run taskkill outlook.exe run outlook.exe end if loop #include <Constants.au3> $proc = "Outlok.exe" ; change this to the process you want to monitor $list = ProcessList($proc) If $list[0][0] = 0 Then MsgBox(0, "Error", " The " & $proc & " process is not running") Exit EndIf For $i = 1 To $list[0][0] $pid = $list[$i][1] Next $cmd = "netstat -ano" $string = _CMDreturn($cmd) ;split the string into an array of individual lines for processing $result = StringSplit($string, @CR) ;process the array For $x = 1 To $result[0] $line = $result[$x] ;get rid of extra white space $newline = StringStripWS($line, 4) ;strip leading @LF characters from the results If StringMid($newline, 1, 1) = @LF Then $newline = StringTrimLeft($newline, 1) ;split the line into another array so we can compare just the PIDs $a_line = StringSplit($newline, " ") If $a_line[0] = 5 Then ;only look at lines that had 5 pieces of info If $a_line[5] = $pid Then MsgBox(0, "Results", "PID=" & $a_line[5] & @CRLF & "IP=" & $a_line[3]) EndIf Next Func _CMDreturn($sCommand) ; Returns the output of a DOS command as a string $cmdreturn = "" $stream = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDOUT_CHILD + $STDIN_CHILD) While 1 ; loop through the return from the command until there is no more $line = StdoutRead($stream) If @error Then ExitLoop $cmdreturn &= $line WEnd Return $cmdreturn EndFunc ;==>_CMDreturn Link to comment Share on other sites More sharing options...
wakillon Posted August 30, 2010 Share Posted August 30, 2010 Please use AutoIt for insert code AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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