Jewtus Posted October 23, 2014 Share Posted October 23, 2014 I'm wondering if there is a way to to proceed to the next record in a "for" loop on an if conditional. This doesn't work, but as an example of what I mean: For $i=0 to UBound($aClose) -1 _IENavigate($oIE, $URL) sleep(200) $oTable = _IETableGetCollection($oIE) $iNumTables = @extended If $iNumTables = 6 Then $oMeta= _IETableGetCollection ($oIE, 5) ; Extract main table $oAutoCloseForm = _IEFormGetObjByName($oIE, "RespondForm") _IEFormElementRadioSelect($oAutoCloseForm,"NO","reason",1,"byValue") ElseIf $iNumTables = 1 Then Next EndIf Next If someone can point me in the right direction, that would be great. Link to comment Share on other sites More sharing options...
jchd Posted October 23, 2014 Share Posted October 23, 2014 For $i=0 to UBound($aClose) -1 _IENavigate($oIE, $URL) sleep(200) $oTable = _IETableGetCollection($oIE) $iNumTables = @extended If $iNumTables = 6 Then $oMeta= _IETableGetCollection ($oIE, 5) ; Extract main table $oAutoCloseForm = _IEFormGetObjByName($oIE, "RespondForm") _IEFormElementRadioSelect($oAutoCloseForm,"NO","reason",1,"byValue") ; ElseIf $iNumTables = 1 Then ; Next EndIf Next This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Jewtus Posted October 23, 2014 Author Share Posted October 23, 2014 (edited) Problem I'm having is that when I run the script, it sometimes hits this error: IE.au3 T3.0-2 Warning from function _IEFormElementRadioSelect, $_IESTATUS_NoMatch and then the script just stalls. I'm trying to make it just move to the next record in the loop if that error occurs. EDIT: I just tried adding this: For $i=0 to UBound($aClose) -1 _IENavigate($oIE, $URL) sleep(200) $oTable = _IETableGetCollection($oIE) $iNumTables = @extended If $iNumTables = 6 Then $oMeta= _IETableGetCollection ($oIE, 5) ; Extract main table $oAutoCloseForm = _IEFormGetObjByName($oIE, "RespondForm") _IEFormElementRadioSelect($oAutoCloseForm,"NO","reason",1,"byValue") If @error = 7 Then ConsoleWrite("Huston we have a problem"&@CRLF) Else MsgBox(0,"","test") endif Endif Next and it continues on, but once it fails to find the radio element, it continuously fails to find it. If I restart the script on the same info, it works fine for about 30 or 40 loops then it gets stuck again. Edited October 23, 2014 by Jewtus Link to comment Share on other sites More sharing options...
Jewtus Posted October 24, 2014 Author Share Posted October 24, 2014 (edited) I've made some changes that seem to prevent it from stalling, but it does have another weird issue. For $x=0 to ubound($sqlRsCloseout) $aClose=$sqlRsCloseout[$x] _IENavigate($oIE, $URL&"?Id=" & $aClose) sleep(200) $oTable = _IETableGetCollection($oIE) $iNumTables = @extended For $z=0 to $iNumTables -1 $oMeta = _IETableGetCollection($oIE, $z) $Check = @extended ;check number of tables to determine what to do $aMeta = _IETableWriteToArray($oMeta, True) If IsArray($aMeta)=1 Then If $check = 9 Then If UBound($aMeta,2) > 1 Then If StringInStr($aMeta[0][1],"Removed") <> 0 Then MsgBox(0,"","Remove me") EndIf EndIf ElseIf $check = 6 Then $oAutoCloseForm = _IEFormGetObjByName($oIE, "RespondForm") While _IEFormElementRadioSelect($oAutoCloseForm,"NO","reason",-1,"byValue") = False _IEFormElementRadioSelect($oAutoCloseForm,"NO","reason",1,"byValue") If @error Then ExitLoop Else sleep(200) MsgBox(0,"","Do this thing" sleep(100) EndIf WEnd EndIf EndIf Next Next It works at first, but once it finds the radio button once, I get this error Warning from function _IEFormElementRadioSelect, $_IESTATUS_NoMatch and then it stops giving me the remove me msg box... Any ideas? If I let it keep running ultimately it crashes and says scite has stopped working (Should I try to debug it?) Edited October 24, 2014 by Jewtus Link to comment Share on other sites More sharing options...
Danp2 Posted October 24, 2014 Share Posted October 24, 2014 $Check = @extended ;check number of tables to determine what to do This line seems to be redundant (you already have the table count in $iNumTables. Beyond that, I'm not sure why you are checking the selected state of the radio element before you try to select it. Can you explain in detail what this code is trying to accomplish? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jewtus Posted October 25, 2014 Author Share Posted October 25, 2014 (edited) I'm checking the radio button because I have run the script and had it get stuck on a page that says you must select an option and the script stops because it wasn't an expected page. I figured I'd make sure that the script checked the radio button before trying to do anything else and the issue of it stopping seems to be resolved. Essentially all I'm trying to do is look to see if the top option of the page says closed and then have it remove it from the list of things I'm looping through, and it if doesn't say closed, find the radio button and check it off and submit the form. edit: I removed the $check and replaced it with $oTable and it seems to work a little better (runs for longer) but I still get a crash and this is the details: Problem signature: Problem Event Name: APPCRASH Application Name: autoit3.exe Application Version: 3.3.13.19 Application Timestamp: 53fa0936 Fault Module Name: OLEAUT32.dll Fault Module Version: 6.1.7601.17676 Fault Module Timestamp: 4e58702a Exception Code: c0000005 Exception Offset: 000211e7 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 Read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 If the online privacy statement is not available, please read our privacy statement offline: C:\Windows\System32\en-USerofflps.txt I have been doing this on the beta build, but I just tried it on the production build and it seems to work without issue... Edited October 25, 2014 by Jewtus 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