Particle Posted January 15, 2008 Share Posted January 15, 2008 Below I wrote a function for my program to open a text file and load it into an edit control and remove unwanted values that some proxy scanners leave behind. It doesn't entirely work and I need to figure out where my problem is at: Func _Load() $file = FileOpenDialog("Open File", @WorkingDir, "Text Files (*.txt)") If @Error = 1 Then GuiCtrlSetData($state,"Unloaded") Else GuiCtrlSetData($state,"Loaded") EndIf Dim $Array $prev = "" _FileReadToArray ($file, $Array ) For $i = 8 to $Array[0] If @error = -1 Then ExitLoop If StringInStr($Array[$i], ",") = 0 Then $temp = StringSplit($Array[$i]," ") GUICtrlSetData($data,GUICtrlRead($DATA)&@CRLF&$temp[1] & ":" & $temp[5]) Else $temp = StringSplit($Array[$i]," ") $tmp = StringSplit($Array[$i],",") For $y = 1 to $tmp[0] If StringInStr($tmp[$y]," ") Then $tp = StringSplit($tmp[$y]," ") For $k = 4 to $tp[0] $tm = $tp[$k] Next $tc = StringSplit($tm,",") GUICtrlSetData($data,GUICtrlRead($DATA)&@CRLF&$temp[1] & ":" & $tc[1]) EndIf Next EndIf Next EndFunc I loaded this txt doc into the program: Generated by Angry IP Scanner 3.0-beta1 http://www.azib.net/ipscan/ Scanned 201.10.0.0 - 201.68.0.0 Jan 2, 2008 7:06:52 PM IP Ports 201.10.8.90 14237,17327 201.10.15.96 14237,17327 201.10.18.87 14237 201.10.30.252 14237,17327 201.10.30.186 14237,17327 And get this output: 201.10.8.90:14237 201.10.8.90: 201.10.15.96:14237 201.10.15.96: 201.10.18.87:14237 201.10.30.252:14237 201.10.30.252: 201.10.30.186:14237 201.10.30.186: Link to comment Share on other sites More sharing options...
Bowmore Posted January 15, 2008 Share Posted January 15, 2008 Below I wrote a function for my program to open a text file and load it into an edit control and remove unwanted values that some proxy scanners leave behind. It doesn't entirely work and I need to figure out where my problem is at: Func _Load() $file = FileOpenDialog("Open File", @WorkingDir, "Text Files (*.txt)") If @Error = 1 Then GuiCtrlSetData($state,"Unloaded") Else GuiCtrlSetData($state,"Loaded") EndIf Dim $Array $prev = "" _FileReadToArray ($file, $Array ) For $i = 8 to $Array[0] If @error = -1 Then ExitLoop If StringInStr($Array[$i], ",") = 0 Then $temp = StringSplit($Array[$i]," ") GUICtrlSetData($data,GUICtrlRead($DATA)&@CRLF&$temp[1] & ":" & $temp[5]) Else $temp = StringSplit($Array[$i]," ") $tmp = StringSplit($Array[$i],",") For $y = 1 to $tmp[0] If StringInStr($tmp[$y]," ") Then $tp = StringSplit($tmp[$y]," ") For $k = 4 to $tp[0] $tm = $tp[$k] Next $tc = StringSplit($tm,",") GUICtrlSetData($data,GUICtrlRead($DATA)&@CRLF&$temp[1] & ":" & $tc[1]) EndIf Next EndIf Next EndFunc I loaded this txt doc into the program: And get this output: 201.10.8.90:14237 201.10.8.90: 201.10.15.96:14237 201.10.15.96: 201.10.18.87:14237 201.10.30.252:14237 201.10.30.252: 201.10.30.186:14237 201.10.30.186:To be able to help you we need to know what you expect the output to look like. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Particle Posted January 15, 2008 Author Share Posted January 15, 2008 well in the output I posted the proxy without a port needs the port there. If you read the txt file I input you'll see that some proxies have multiple ports that i'm trying to split by the comma and paste each one for use. Link to comment Share on other sites More sharing options...
Bowmore Posted January 15, 2008 Share Posted January 15, 2008 well in the output I posted the proxy without a port needs the port there. If you read the txt file I input you'll see that some proxies have multiple ports that i'm trying to split by the comma and paste each one for use. I think this should give you the result you are looking for. Func _Load($Data_In) Local $NewData $file = FileOpenDialog("Open File", @WorkingDir, "Text Files (*.txt)") If @Error = 1 Then GuiCtrlSetData($state,"Unloaded") Else GuiCtrlSetData($state,"Loaded") EndIf Local $Array _FileReadToArray ($file, $Array ) $NewData = '' For $ip = 8 to $Array[0] $temp = StringSplit($Array[$ip]," ,") If IsArray($temp) Then For $port = 2 To $temp[0] $NewData &= $temp[1] & ":" & $temp[$port] & @CRLF Next EndIf Next GUICtrlSetData($data,$NewData) EndFunc Note: The above code has not been fully tested as I didn't have you gui. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Particle Posted January 16, 2008 Author Share Posted January 16, 2008 Thats alright, I did one small line edit and it works perfectly now, thanks for the basic layout! 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