Jump to content
stick3r

Need help with IE logic

Recommended Posts

Hi,

I am trying to improve my colleagues written script. He is not working here anymore, so I can not discuss with him :)

This is a working code. It gets all links and clicks on one with "distribution" and then does other things in _selectAddToSchedule().

$objFrame = _IEFrameGetObjByName($g_objIE, "SCHED_FRAME")
    $objForm = _IEFormGetObjByName($objFrame, "form")

    Local $objTable = _IETableGetCollection($objForm, 0)
    Local $arrTableData = _IETableWriteToArray($objTable)
    Local $ColumnNumber = 1

    Local $objLinks = _IELinkGetCollection($objForm)
    For $objLink In $objLinks
        Local $strLinkText = _IEPropertyGet($objLink, "innerText")
        If StringInStr($strLinkText, "distribution") Then
            _IEAction($objLink, "click")
            _selectAddToSchedule()
        EndIf
    Next

What I need to do is not to click on "distribution" every time. There might be 5 distributions to click on and do things, but I only need it to click depending on one condition.

Row Col 0 Col 1 Col 2
[0] Customer NAME NAME
[1] Report Fx Fx
[2] Interval Once Yearly
[3] Next Report Date Fri 29 Mar  Tue 31 Dec 
[4] Schd Id 9999 4009
[5] Active    
[6] No Suppr    
[7]   distribution distribution
[8]   details details
[9]   delete delete

Here is a table from the same form. In row 7 there is that link "distribution". But I only need it to click on distribution if row 2 is "Once". In this case only one time. No need to click second time, where row 2 is Yearly.

Row 2 is not a link. Therefore it does not get into the collection of $objLinks. It is only text.

Any ideas how to do it?

Share this post


Link to post
Share on other sites
29 minutes ago, stick3r said:

Local $arrTableData = _IETableWriteToArray($objTable)

Assuming that this is the table in question, then you already have it's contents in an array. You should be able to test for the value of "Once" before clicking the link. You obviously need to know which column to check, so keep a counter to know how many times the "distribution" link has been detected thus far.

Share this post


Link to post
Share on other sites

Yeap, that is correct. This is that one table. I tried checking with it, but I am not sure how to do it correctly :)

Since this web page is not public, I can not access and test it at home.

I tried something like this and it did not work. Not sure if it was exactly the same. 

Is this the right logic?

P.S. There are 3 links in a $arrTableData column - distribution, details and delete.

Others are texts.

 $ColumnNumber = 1
 For $objLink In $objLinks
     Local $strLinkText = _IEPropertyGet($objLink, "innerText")
        If StringInStr($strLinkText, "distribution") And $arrTableData[2][$ColumnNumber] = “Once” Then
            _IEAction($objLink, "click")
            _selectAddToSchedule()
            $ColumnNumber = $ColumnNumber + 1 
        EndIf
 Next

 

Share this post


Link to post
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

×
×
  • Create New...