Jump to content

scraps

Members
  • Posts

    7
  • Joined

  • Last visited

scraps's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks Smashly, I do understand about Mac address being hex value, was just messing around with the values and guess i should have made the example in hex. Thanks everyone for your help, most appreciated
  2. Hi everyone, Thanks for your help, Both Damien and Smashly's examples resulted in a win for me , But so i can learn more about this function could i possibly get a break down? - sets Case-insensitivity flag, matches anything including newline, (then im lost) think 255. is to do with the subnet mask. tried to make sense of it in the help file but got little lost
  3. Hi Guys, I have been trying to work with StringRegExpReplace() , but have had no such luck. I am wanting to extract just the MACaddress from string. 77.10.119.232 - 255.255.254.0 - 00-15-46-5b-0t-z4 -27/09/2011 8:30:52 AM -D- PC0005.test.local - after the IP there is 3 spaces then a hyphen, subnet, 2 white spaces, hypen, white space then mac address. If someone could help me with a break down of various expressions I would use. thanks in advance.
  4. Okay found a way: #include <Array.au3> #include <File.au3> local $avArray _FileReadToArray("C:\filtered_proc3.txt", $avArray) _ArrayDisplay($avArray, "$avArray2") local $targetHost = "PC005" $sColumn = 1 $iIndex = _ArraySearch($avArray, $targetHost, 0, 0, 0, 1, 1, $sColumn) MsgBox(64, "array", $avArray[$iIndex]) FileWriteLine("C:\filtered_proc5.txt", $avArray[$iIndex]) If @error Then MsgBox(0, "Not Found", '"' & $targetHost & '" was not found on column ' & $sColumn & '.') Else $test = _ArrayToString($iIndex) EndIf MsgBox(64, "array", $avArray[$iIndex])
  5. Hi Again, I am working in stages with this, and have it working up to a point (will post code once have final draft) , I also needed to incorporate StringStripWS, so the IP addresses were the only data in the output file. Was wondering what is the function to print to screen a single array element? to be saved in a text file. so If i find a value of an array element [140] save the value of the element to text file? #include <Array.au3> #include <File.au3> local $avArray _FileReadToArray("C:\filtered_proc3.txt", $avArray) _ArrayDisplay($avArray, "$avArray2") local $targetHost = "pc005" $sColumn = 1 $iIndex = _ArraySearch($avArray, $targetHost, 0, 0, 0, 1, 1, $sColumn) If @error Then MsgBox(0, "Not Found", '"' & $targetHost & '" was not found on column ' & $sColumn & '.') Else $test = _ArrayToString($iIndex) EndIf MsgBox(0, "", $iIndex) Thanks for your help
  6. Thanks Melba23 and UEZ, will let you know how I have progressed with the solutions you have provided.
  7. Hi people, I am a Novice with Autoit so please bare with me and my lack of knowledge in this area. I have been trying to track down a solution, by searching forums and the help file for the efficient way of extracting certain elements from a text file generated from netsh.exe command. the elements are the IP addresses. the IP addresses start on the 6th line and could stop on the 8-50th line. If I could some how write to array each line starting from 6 and stop when a line contains string total. but only capture the first element of each line within those parameters. the text file: My broken code thus far (this doesn't work I know still working on it) $sNetshcmd = RunAs($sUserName, $sDomain, $sPwd, 0, "cmd /c " & $sCmd, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) While True $data &= StdoutRead($sNetshcmd) If @error Then ExitLoop Sleep(25) WEnd ;FileWrite($sFile, $data) ;ProcessClose($sNetshcmd) for $i = 1 to 100 $sString = FileReadLine($sNetshcmd, $i) if $sString = "Total" then ExitLoop FileWriteLine($sFile, 1) Next Run("notepad.exe " & $sFile) EndFunc ;==>_proc1 Func _proc2() _FileReadToArray($sFile, $dhcpScopeList) while 1 _FileWriteFromArray($sFile, $dhcpScopeList, 6, 0) if $sString = StringInStr FileClose($sFile) Run("notepad.exe " & $sFile) EndFunc ;==>_proc2 If someone could please point me in the right direction and possibly a small example to get me started, it would be greatly appreciated. thank you.
×
×
  • Create New...