Jump to content

For In Next Loop


 Share

Recommended Posts

I'll go ahead and admit up front that I'm a complete noob. I've been trying to find out about For In Next loops but can't seem to get it right. What I'm trying to do is read through a table and have it check the check-box if it finds the text "Retrieved" or "No Data Found". That's it. I already have my object variable for that table. I just can't figure out how to read through it and check the box appropriately. Here is one row from the table as an example. Thanks for your help.

<TR><TD style="BACKGROUND-COLOR: white" onclick=ChangeBackground(event,0,1); width="4%" align=middle><INPUT onclick=BoxChecker(0) value=236780502 type=checkbox name=ReportBox></TD>
<TD style="BACKGROUND-COLOR: white" width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>236780502</SPAN></TD>
<TD style="BACKGROUND-COLOR: white" width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(0)>Retrieved</SPAN></TD>
<TD style="BACKGROUND-COLOR: white" width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>MAIADB_PO_DETAILS_DAILY_L13_NEW_CORRECTED </SPAN></TD>
<TD style="BACKGROUND-COLOR: white" width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>&nbsp;2010-10-21 01:12:36</SPAN></TD>
<TD style="BACKGROUND-COLOR: white" width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>1,904.71Kb</SPAN></TD>
<TD style="BACKGROUND-COLOR: white" width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>&nbsp; &nbsp; Text</SPAN></TD></TR>
Link to comment
Share on other sites

So I assume the table info is stored in an array?

$Retrieved = 0
$No_Data_Found = 0
for $i = 0 to UBound($aTable)-1
    if StringInStr($aTable[$i],"Retrieved") Then
        $Retrieved += 1
        ContinueLoop
    endif
    if StringInStr($aTable[$i],"No Data Found") Then
        $No_Data_Found += 1
        ContinueLoop
    endif
Next
MsgBox(0,"",$Retrieved & @crlf & $No_Data_Found)
Link to comment
Share on other sites

So I assume the table info is stored in an array?

$Retrieved = 0
$No_Data_Found = 0
for $i = 0 to UBound($aTable)-1
    if StringInStr($aTable[$i],"Retrieved") Then
        $Retrieved += 1
        ContinueLoop
    endif
    if StringInStr($aTable[$i],"No Data Found") Then
        $No_Data_Found += 1
        ContinueLoop
    endif
Next
MsgBox(0,"",$Retrieved & @crlf & $No_Data_Found)

It wasn't but I tried to write it to an array then run your code and I get this:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Datasync\checkboxtest2.au3"

C:\Datasync\checkboxtest2.au3 (16) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

if StringInStr($aTable[$i],"Retrieved") Then

if StringInStr(^ ERROR

>Exit code: 1 Time: 2.022

I'm currently searching the forums but if someone knows what I did wrong then I'm all ears.

Link to comment
Share on other sites

What you did wrong, you tried to run his code (which was a generic code just to show you how to do it) and of course your array (if you have one) is not by far named $aTable.

What you need to do is: try to understand the example and to adapt it to your case. You haven't posted any code here, all you gave is a snippet from a html file - it is normal to get a "generic" solution back.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

What you did wrong, you tried to run his code (which was a generic code just to show you how to do it) and of course your array (if you have one) is not by far named $aTable.

What you need to do is: try to understand the example and to adapt it to your case. You haven't posted any code here, all you gave is a snippet from a html file - it is normal to get a "generic" solution back.

Here is the entire form that I'm trying to work with.

<FORM id=RowSelected method=post name=RowSelected action=ReportStatus_Table2.aspx?ApplicationId=300><DIV><INPUT id=__VIEWSTATE value=/wEPDwUKMTQxMjAwNzYxNWRkfBMGfYTWvgUZqXXh/gxVoL/oajw= type=hidden name=__VIEWSTATE> </DIV>
<DIV><INPUT id=__EVENTVALIDATION value=/wEWDgKstNKEDgLigZ2zBgKR6ezbBQKA+vyYCAKAgLY5ApC4yOkEAqel/8wEArP2sWcC8Nqwrw0CqPHwzgUCzqmXww8C5br87QwCiJGXyAwCg52smwqapIxPIuBxrWZ3c80HibiAmlmhlQ== type=hidden name=__EVENTVALIDATION> </DIV><LINK title=style1024 rel=stylesheet type=text/css href="StyleSheet/style1024.css"><LINK title=style800 disabled rel=stylesheet type=text/css href="StyleSheet/style800.css">
<script language=javascript type=text/javascript>
var styleTitle = (screen.width > 800) ? 'style1024' : 'style800';
if(document.styleSheets){
    for(var i=0; i<document.styleSheets.length; i++) {
        document.styleSheets[i].disabled = (document.styleSheets[i].title != styleTitle);
    }
}
</SCRIPT>
<INPUT type=hidden name=id> <INPUT type=hidden name=JobId> <INPUT type=hidden name=Filename> <INPUT type=hidden name=Extension> <INPUT type=hidden name=Status> <INPUT type=hidden name=ReqName> 
<TABLE id=myTable border=0 cellSpacing=0 cellPadding=0 width="100%">
<DIV id=panAdd></DIV>
<TBODY>
<TR>
<TD onclick=ChangeBackground(event,0,1); width="4%" align=middle><INPUT onclick=BoxChecker(0) value=236850166 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>236850166</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(0)>Retrieved</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>MAIADB_PO_DETAILS_DAILY_L13_NEW_CORRECTED </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>&nbsp;2010-10-22 01:17:13</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>1,904.49Kb</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(0)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,1,1); width="4%" align=middle><INPUT onclick=BoxChecker(1) value=236850091 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(1)>236850091</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(1)>Retrieved</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(1)>OH_TRACKER_NEW </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(1)>&nbsp;2010-10-22 06:03:30</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(1)>1,842.26Kb</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(1)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,2,1); width="4%" align=middle><INPUT onclick=BoxChecker(2) value=236846388 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(2)>236846388</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(2)>Retrieved</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(2)>MAIADB_SAMSUS_PO_DETAILS_L13_NEW1 </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(2)>&nbsp;2010-10-22 00:25:55</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(2)>37.83Kb</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(2)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,3,1); width="4%" align=middle><INPUT onclick=BoxChecker(3) value=236846194 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(3)>236846194</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(3)>Retrieved</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(3)>MAIADB_PO_DETAILS_DAILY_L13_NEW </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(3)>&nbsp;2010-10-22 00:59:29</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(3)>1,884.77Kb</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(3)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,4,1); width="4%" align=middle><INPUT onclick=BoxChecker(4) value=236839439 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(4)>236839439</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(4)>Retrieved</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(4)>MAIADB_CA_PO_DETAILS_DAILY_L13_NEW </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(4)>&nbsp;2010-10-22 01:44:04</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(4)>387.68Kb</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(4)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,5,1); width="4%" align=middle><INPUT onclick=BoxChecker(5) value=236839384 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(5)>236839384</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #aa2222; CURSOR: hand" class=status_table onclick=GetFile(5)>Retrieved</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(5)>MAIADB_MX_PO_DETAILS_DAILY_L13_NEW </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(5)>&nbsp;2010-10-22 01:51:45</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(5)>10.01Kb</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(5)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,6,1); width="4%" align=middle><INPUT onclick=BoxChecker(6) value=236838913 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(6)>236838913</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #ff0000; CURSOR: hand" class=status_table onclick=GetFile(6)>No Data Found</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(6)>MAIADB_DAYS_NOSALES_SAMS_CA_DAILY_DATA </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(6)>&nbsp;2010-10-22 00:20:12</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(6)>340b</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(6)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,7,1); width="4%" align=middle><INPUT onclick=BoxChecker(7) value=236768610 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(7)>236768610</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: #ff0000; CURSOR: hand" class=status_table onclick=GetFile(7)>No Data Found</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(7)>MAIADB_DAYS_NOSALES_SAMS_CA_DAILY_DATA </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(7)>&nbsp;2010-10-21 00:24:58</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(7)>340b</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(7)>&nbsp; &nbsp; Text</SPAN></TD></TR>
<TR>
<TD onclick=ChangeBackground(event,8,1); width="4%" align=middle><INPUT onclick=BoxChecker(8) value=236748514 type=checkbox name=ReportBox></TD>
<TD width="12%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(8)>236748514</SPAN></TD>
<TD width="15%" align=left><SPAN style="COLOR: navy; CURSOR: hand" class=status_table onclick=GetFile(8)>Waiting</SPAN></TD>
<TD width="29%" align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(8)>WSWMI 383489 - Sep10 </SPAN></TD>
<TD width="11%" noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(8)>&nbsp;2010-10-22 09:03:46</SPAN></TD>
<TD width="13%" align=middle><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(8)>b</SPAN></TD>
<TD width=* noWrap align=left><SPAN style="CURSOR: hand" class=status_table onclick=GetFile(8)>&nbsp; &nbsp; Excel</SPAN></TD></TR>

<DIV></DIV></TBODY></TABLE><INPUT id=hdnTransNoRequestSelected value="There is no Request selected." type=hidden name=hdnTransNoRequestSelected> <INPUT id=hdnTransYouCannotRetrieve value="You cannot Retrieve request" type=hidden name=hdnTransYouCannotRetrieve> <INPUT id=hdnTransStatusIsWaiting value=" in Waiting Status" type=hidden name=hdnTransStatusIsWaiting> <INPUT id=hdnTransStatusIsPending value=" Status Pending" type=hidden name=hdnTransStatusIsPending> <INPUT id=hdnTransStatusIsActive value=" in Active Status
The Request will not be retrieve" type=hidden name=hdnTransStatusIsActive> <INPUT id=hdnTransErrorIsFormating value="with Format Errors" type=hidden name=hdnTransErrorIsFormating> <INPUT id=hdnTransRetrieveTryAgain value="Select a Request and try again" type=hidden name=hdnTransRetrieveTryAgain> <INPUT id=hdnTransDeleteTryAgain value="Select a Request and try again" type=hidden name=hdnTransDeleteTryAgain> <INPUT id=hdnTransReOpenTryAgain value="Select a Request and try again" type=hidden name=hdnTransReOpenTryAgain> <INPUT id=hdnTransNoRequestFound value="There are no DSS Requests for" type=hidden name=hdnTransNoRequestFound> <INPUT id=hdnTransNoRequestTimeYet value="Still Active" type=hidden name=hdnTransNoRequestTimeYet> <INPUT id=hdnTransSendTryAgain value="Select a Request and try again" type=hidden name=hdnTransSendTryAgain> <INPUT id=hdnTransModifyReportAlert value="Please modify quick view reports from the 'My Reports' link" type=hidden name=hdnTransModifyReportAlert>
<script type=text/javascript>function Sender(to,id,Qids){ var w_height=screen.availheight - 110;var w_width=screen.availwidth - 280;var xMax = screen.width, yMax = screen.height;var w = xMax - 100;var h = yMax - 120;var xOffset = (xMax - w) / 2;var yOffset = (yMax - h) / 3;if(to == 1){if(FileExtArray[id] == 'xls' || FileExtArray[id] == 'mdb' || FileExtArray[id] == 'zip' )window.open('Status_retrieve_request.aspx?questionid='+Qid[id]+'&applicationid='+ApplId[id]+'&JobId='+JodIdArray[id]+'&status='+StatusArray[id]+'&Extension='+FileExtArray[id]+'&filename='+FileNameArray[id]+'&reqname='+ReqNameArray[id],JodIdArray[id],'height=250,width=350,top=50,left=150,scrollbars=yes,status=no,resizable=yes,toolbars=no,menubar=no');else window.open('Status_retrieve_request.aspx?questionid='+Qid[id]+'&applicationid='+ApplId[id]+'&JobId='+JodIdArray[id]+'&status='+StatusArray[id]+'&Extension='+FileExtArray[id]+'&filename='+FileNameArray[id]+'&reqname='+ReqNameArray[id],JodIdArray[id],'height='+w_height+',width='+w_width+',top=50,left=100,scrollbars=yes,status=no,resizable=yes,toolbars=no,menubar=no');}if(to == 2){window.open('delete_request.aspx?questionid='+Qid[id]+'&applicationId='+ApplId[id]+'&JobId='+JodIdArray[id],JodIdArray[id] + '_del','height=50,width=350,top=200,left=350,scrollbars=no,status=no,resizable=no,toolbars=no,menubar=no');}if(to == 2.5){window.open('delete_request.aspx?questionid='+Qids+'&JobId='+id,'6y77k79y35y3','height=50,width=350,top=200,left=350,scrollbars=no,status=no,resizable=no,toolbars=no,menubar=no');}if(to == 3){window.open('SendEmail.aspx?Id='+id+'&type=0&JobId='+JodIdArray[id]+'&ReqName='+ReqNameArray[id]+'&Extension='+FileExtArray[id]+'&filename='+FileNameArray[id],'Email','height=300,width=460,top=150,left=200,scrollbars=no,status=no,resizable=no,toolbars=no,menubar=no');}if(to == 4){if(Number(FormatTypeArray[id]) != 10){if(ApplId[id] >= 300 && ApplId[id] <= 499){window.open('Report_Builder.aspx?country_cd='+CountryId[id]+'&qid='+Qid[id]+'&exe_id='+ExeId[id]+'&AppId='+ApplId[id]+'&divid='+DivId[id]+'&JobId='+JodIdArray[id]+'&reopen=true',JodIdArray[id] + '_mod', 'scrollbars=no,width='+w+',height='+h+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset);}else{window.open('/dss/common/appl/applet_window.asp?areacolor=&jobid='+JodIdArray[id],JodIdArray[id] + '_mod', 'resize=yes,scrollbars=yes,status=no,directories=no,menubar=yes,location=no,width=760,height=450,screenX=10,left=10,screenY=20,top=20');}}else{window.alert('Please modify quick view reports from the \'My Reports\' link');}}}</SCRIPT>
 </FORM>

The loop doesn't do what I need to do at this point but right now I'm just trying to find a way to find the right text. My main goal is to check the checkbox if it finds the words "Retrieved" or "No data found" under the same TR.

#include <IE.au3>

$oIE = _IEAttach("Retail Link")
$o_form1 = _IEFormGetObjByName($oIE, "main")
$o_frame1 = _IEFrameGetObjByName($o_form1, "ifrContent")
$o_form2 = _IEFormGetObjByName ($o_frame1, "Form1")
$o_frame2 = _IEFrameGetObjByName($o_form2, "JobTable")
$o_form3 = _IEFormGetObjByName ($o_frame2, "RowSelected")
$oTRs = _IETagNameGetCollection($o_form3, 'tr') 
For $oTR In $oTRs     
    If $oTR.TD = 'status_table' Then         
        Sleep(1000)         
        $atext = StringInStr(_IEPropertyGet($oTR, 'innertext'), "Retrieved")         
        MsgBox(0, "Innertext", $atext)
        ExitLoop     
    EndIf 
Next
Edited by SnoozeAr
Link to comment
Share on other sites

So... what AutoIt functions do you use to read the source-table? _IETableGetCollection()? _IETableWriteToArray() returns a 2-dimensional array.

#include <IE.au3>
#include <array.au3>
$oIE = _IE_Example("table")
$oTable = _IETableGetCollection($oIE, 0)
$aTableData = _IETableWriteToArray($oTable)

_ArrayDisplay($aTableData)

$Retrieved = 0
$No_Data_Found = 0

For $i = 0 To UBound($aTableData) - 1
    For $y = 0 To UBound($aTableData,2) - 1

        If StringInStr($aTableData[$i][$y], "the") Then ; Retrieved
            $Retrieved += 1
            ContinueLoop
        EndIf
        If StringInStr($aTableData[$i][$y], "come") Then ; No Data Found
            $No_Data_Found += 1
            ContinueLoop
        EndIf
    Next
Next
MsgBox(0, "", $Retrieved & @CRLF & $No_Data_Found)
Edited by KaFu
Link to comment
Share on other sites

I just can't seem to figure out how to make it cycle through to hit the checkbox once it finds the line that has "Retrieved" or "No Data Found". I need to find the row with my keywords in it then read Column1 in order to find the right checkbox. The checkbox value's = Column1. I hope this is making more sense. Any help is appreciated.

#include <IE.au3>
#include <array.au3>

$oIE = _IEAttach("Retail Link")
$o_form1 = _IEFormGetObjByName($oIE, "main")
$o_frame1 = _IEFrameGetObjByName($o_form1, "ifrContent")
$o_form2 = _IEFormGetObjByName ($o_frame1, "Form1")
$o_frame2 = _IEFrameGetObjByName($o_form2, "JobTable")
$o_form3 = _IEFormGetObjByName ($o_frame2, "RowSelected")
$oTable = _IETableGetCollection($o_form3, 0)
$aTableData = _IETableWriteToArray($oTable, True)

;_ArrayDisplay($aTableData)

;$Retrieved = 0
;$No_Data_Found = 0

For $i = 0 To UBound($aTableData) - 1
    For $y = 0 To UBound($aTableData,2) - 1

        If StringInStr($aTableData[$i][$y], "Retrieved") Then ; Retrieved
            $itemnumber = StringInStr($aTableData, $aTableData[0][1])
            _IEFormElementCheckboxSelect($o_form3, $itemnumber)
            ContinueLoop
        EndIf
        If StringInStr($aTableData[$i][$y], "No Data Found") Then ; No Data Found
            $itemnumber = $aTableData[0][1]
            _IEFormElementCheckboxSelect($o_form3, $itemnumber)
            ContinueLoop
        EndIf
    Next
Next
;MsgBox(0, "", $Retrieved & @CRLF & $No_Data_Found)

Here is my array.

Posted Image

Link to comment
Share on other sites

You don't need 2 loops at all - see the modified code (you had also some other errors - everytime checking [0][1] instead of [$y][1])

#include <IE.au3>
#include <array.au3>

$oIE = _IEAttach("Retail Link")
$o_form1 = _IEFormGetObjByName($oIE, "main")
$o_frame1 = _IEFrameGetObjByName($o_form1, "ifrContent")
$o_form2 = _IEFormGetObjByName ($o_frame1, "Form1")
$o_frame2 = _IEFrameGetObjByName($o_form2, "JobTable")
$o_form3 = _IEFormGetObjByName ($o_frame2, "RowSelected")
$oTable = _IETableGetCollection($o_form3, 0)
$aTableData = _IETableWriteToArray($oTable, True)

;_ArrayDisplay($aTableData)

;$Retrieved = 0
;$No_Data_Found = 0


For $y = 0 To UBound($aTableData,2) - 1

    If StringInStr($aTableData[$y][2], "Retrieved") Then ; Retrieved
        $itemnumber = StringInStr($aTableData, $aTableData[$y][1])
        _IEFormElementCheckboxSelect($o_form3, $itemnumber)
        ContinueLoop
    EndIf
    If StringInStr($aTableData[$y][2], "No Data Found") Then ; No Data Found
        $itemnumber = $aTableData[$y][1]
        _IEFormElementCheckboxSelect($o_form3, $itemnumber)
        ContinueLoop
    EndIf
Next

;MsgBox(0, "", $Retrieved & @CRLF & $No_Data_Found)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...