Particle Posted October 12, 2007 Share Posted October 12, 2007 Ok I am having this probem with one of my programs thats driving me crazy. It's a fast proxy testing program where u can load a text file of proxies and it's suppose to test them and tell u which ones are still alive or if they died out. I don't know if I wrote the arrays wrong or what but it seems to not work and all the proxies are just showing up as "Disconnected" expecially on ones that i know are alive. Help? If $msg = $fptload Then $file = FileOpenDialog("Choose file...",@WorkingDir,"Text Documents (*.txt)") TCPStartup() $Count = _FileCountLines($file) $i = 1 Dim $Array[$Count] Do $Array[$i] = FileReadLine($file,$i) $port = StringSplit($Array[$i],":") $tcprun = TCPConnect($Array[$i],$port[2]) If $tcprun = -1 Then GuiCtrlCreateListViewItem($Array[$i]&"|Disconnected",$proxylist) Else GuiCtrlCreateListViewItem($Array[$i]&"|Connected",$proxylist) EndIf $i = $i + 1 Until $i = $Count TCPShutdown() EndIf Link to comment Share on other sites More sharing options...
weaponx Posted October 12, 2007 Share Posted October 12, 2007 (edited) #include <File.au3> If $msg = $fptload Then $file = FileOpenDialog("Choose file...",@WorkingDir,"Text Documents (*.txt)") TCPStartup() Dim $Array $Array = _FileReadToArray ($file, $Array ) If $Array[0] = 0 Then MsgBox(0,"", "File is empty") EndIf For $i = 1 to $Array[0] $port = StringSplit($Array[$i],":") $tcprun = TCPConnect($Array[$i],$port[2]) Switch @error Case 1 MsgBox(0,"","Ip address is incorrect") Case 2 MsgBox(0,"","Port is incorrect") EndSwitch If $tcprun = -1 Then GuiCtrlCreateListViewItem($Array[$i]&"|Disconnected",$proxylist) Else GuiCtrlCreateListViewItem($Array[$i]&"|Connected",$proxylist) EndIf Next TCPShutdown() EndIf EDIT: What format is the data in your text file being read? Edited October 12, 2007 by weaponx Link to comment Share on other sites More sharing options...
Particle Posted October 12, 2007 Author Share Posted October 12, 2007 #include <File.au3>EDIT: What format is the data in your text file being read?i have that include in there. i didnt' post the entire code.the format is like this201.1.5.22:1080201.252.62.1:1080etc. Link to comment Share on other sites More sharing options...
weaponx Posted October 12, 2007 Share Posted October 12, 2007 (edited) I see the problem. You were calling TCPConnect like this TCPConnect("201.1.5.22:1080", "1080") If $msg = $fptload Then $file = FileOpenDialog("Choose file...",@WorkingDir,"Text Documents (*.txt)") TCPStartup() Dim $Array $Array = _FileReadToArray ($file, $Array ) If $Array[0] = 0 Then MsgBox(0,"", "File is empty") EndIf For $i = 1 to $Array[0] $temp = StringSplit($Array[$i],":") $ipAddress = $temp[1] $port = $temp[2] $tcprun = TCPConnect($ipAddress,$port) Switch @error Case 1 MsgBox(0,"","Ip address is incorrect") Case 2 MsgBox(0,"","Port is incorrect") EndSwitch If $tcprun = -1 Then GuiCtrlCreateListViewItem($Array[$i]&"|Disconnected",$proxylist) Else GuiCtrlCreateListViewItem($Array[$i]&"|Connected",$proxylist) EndIf Next TCPShutdown() EndIf Edited October 12, 2007 by weaponx Link to comment Share on other sites More sharing options...
Particle Posted October 12, 2007 Author Share Posted October 12, 2007 i tried that piece of code u wrote there and i got this: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Au3 Files\FPT.au3" C:\Au3 Files\FPT.au3 (26) : ==> Subscript used with non-Array variable.: If $Array[0] = 0 Then If $Array^ ERROR >Exit code: 1 Time: 5.946 Link to comment Share on other sites More sharing options...
weaponx Posted October 12, 2007 Share Posted October 12, 2007 Sorry. I forgot _FileReadToArray returns 1 or 0 and not the actual array. Change this line: $Array = _FileReadToArray ($file, $Array ) to _FileReadToArray ($file, $Array ) Link to comment Share on other sites More sharing options...
Particle Posted October 12, 2007 Author Share Posted October 12, 2007 very nice thanks 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