faustf Posted June 26, 2016 Share Posted June 26, 2016 hi guy i hav e a strange problem with a script and array i have created this script expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <IE.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <InetConstants.au3> #include <WinAPI.au3> #include <WinAPIsysinfoConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <INet.au3> #include <Excel.au3> #include <File.au3> #include <Array.au3> If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running. ProcessClose("iexplore.exe") EndIf _entra_dentro() Func _entra_dentro() Local $page_num = 0 Global $oIE Do If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running. ProcessClose("iexplore.exe") EndIf $oIE = _IECreate("https://incloak.com/proxy-list/?start=" & $page_num & "#list", 0, 1, 1, 1) _IELoadWait($oIE) Local $sText = _IEBodyReadHTML($oIE) Local $sText2 = _IEBodyReadText($oIE) ;ConsoleWrite($sText) Local $aArray_link_altrePAG1_2 = StringRegExp($sText, '(?is)="tdl">(.*?)</td><td>(.*?)</td>', 3) ;_ArrayDisplay($aArray_link_altrePAG1_2) Local $sFilePath = @ScriptDir & "\Examples.txt" Local $i = 0 Local $h = 1 Local $total = UBound($aArray_link_altrePAG1_2, $UBOUND_ROWS) ;MsgBox (0,'',$total) ;_ArrayDisplay($aArray_link_altrePAG1_2) ;For $i = 0 To UBound ($aArray_link_altrePAG1_2) -1 Do FileWrite($sFilePath, "Http://" & $aArray_link_altrePAG1_2[$i] & ":" & $aArray_link_altrePAG1_2[$h] & @CRLF) ;MsgBox (0,'',$i) ;MsgBox (0,'127',$h) $i += 2 $h += 2 Until $h = ($total - 1) $page_num += 64 Until $page_num = 640 MsgBox(0, '', 'fine') EndFunc ;==>_entra_dentro this script some time work "good" after 3 page go in error with this code FileWrite($sFilePath, "Http://" & $aArray_link_altrePAG1_2[$i] & ":" & $aArray_link_altrePAG1_2[$h] & @CRLF) FileWrite($sFilePath, "Http://" & $aArray_link_altrePAG1_2^ ERROR ->11:40:34 AutoIt3.exe ended.rc:1 +>11:40:34 AutoIt3Wrapper Finished. and some time give me this error at first page , but if i insert a msgbox for debugging like Msgbox (0,'',$i) down filewrite , the script work good and arrive at 3° page and go in error where is the problem ??? thsankz at all Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2016 Developers Share Posted June 26, 2016 1 minute ago, faustf said: and some time give me this error at first page Define THIS! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
faustf Posted June 26, 2016 Author Share Posted June 26, 2016 sorry the same error FileWrite($sFilePath, "Http://" & $aArray_link_altrePAG1_2[$i] & ":" & $aArray_link_altrePAG1_2[$h] & @CRLF) FileWrite($sFilePath, "Http://" & $aArray_link_altrePAG1_2^ ERROR ->11:40:34 AutoIt3.exe ended.rc:1 +>11:40:34 AutoIt3Wrapper Finished. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2016 Developers Share Posted June 26, 2016 What do you think will happen when this statement: Local $total = UBound($aArray_link_altrePAG1_2, $UBOUND_ROWS) Fails and returns an Error when the variables isn't an array? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
faustf Posted June 26, 2016 Author Share Posted June 26, 2016 ubound return a number of total array Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2016 Developers Share Posted June 26, 2016 Reread my question as my assumption is that the variable is NOT an array due to a regex failure. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2016 Developers Share Posted June 26, 2016 On top of that: You are adding 2 in each loop which also could cause an error: Do FileWrite($sFilePath, "Http://" & $aArray_link_altrePAG1_2[$i] & ":" & $aArray_link_altrePAG1_2[$h] & @CRLF) ;MsgBox (0,'',$i) ;MsgBox (0,'127',$h) $i += 2 $h += 2 Until $h = ($total - 1) So it's time you add some consolewrite debugging statements in you code to figure out why you are getting this error! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2016 Developers Share Posted June 26, 2016 This demonstrates my first point with an empty array: $a = "" ConsoleWrite("! Start For loop" & @CRLF) For $x = 0 to UBound($a)-1 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $a = ' & $a[$x] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Next ConsoleWrite("! Start Do loop" & @CRLF) $x=0 Do ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $a = ' & $a[$x] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $x+=1 until UBound($a) Over to you. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
faustf Posted June 26, 2016 Author Share Posted June 26, 2016 o understund some time velocity of page is not good for thake a total by ubound Link to comment Share on other sites More sharing options...
faustf Posted June 26, 2016 Author Share Posted June 26, 2016 thankzz so much 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