Jump to content

Recommended Posts

Posted

I'm hoping someone can bump me in the right direction.

Within an internal company website there is a page I'm trying to automate, this page has a table containing a number of employee's Names, their ID's and a drop-down list of what their working hours should be charged as.

I'm trying to automate the entry to the webtool from a shared excel document.

In the example below the select element's are dynamically named based on the employee's ID. The column beside the select box contains the employee's name and what I've done is dumped the table to an array and searched the name column to match up with the employers name from the spreadsheet to find out which row the select box I need to change is.

$oIE = _IECreate("http://Fakewebsite.com", 1)

$oIE = _IECreate("http://Fakewebsite.com/", 1)

        $TableOfBoxes = 8 ;The table containing the data I want to mess with is table #8 on the page.
    $oTable2 = _IETableGetCollection($oIE, $TableOfBoxes)
    $aTableData2 = _IETableWriteToArray($oTable2, True) ; Write the table to an array so I can analyze it.
    ;Determine how many rows are in Table 13
    $mydim2 = UBound($aTableData2, 1)

    $RowOFActivitytocomplete = "None Found" ;declare starting variable for future error checking.

        ;Compare the row of names in the current sheet with the array value from the spreadsheet and add some zero's.
    For $j = 0 To $mydim2
    If $aTableData2[$j][5] = $aTableData[$i + 2][8] &"    " Then
        $RowOFActivitytocomplete = $j
        ExitLoop
    EndIf

    Next

       ;I found out that the $j (the row that contains the user I want to change) is 2.  If I could somehow count how many select element's there are and then change it by index.  Or if I could use the index to determine the name of the select then use _IEFormGetObjByName I could change it.  I just don't know how which function/syntax to use.

#CE

<html><body><form action=""><select name="w_1502397_sch" class="small" onchange="PBSchChange(1502397);"><option value="Vacation">Vacation</option><option value="Sick">Sick</option><option value="FullTime">FullTime</option><option value="Part-Time">Part-Time</option></select><select name="w_6786455_sch" class="small" onchange="PBSchChange(6786455);"><option value="Vacation">Vacation</option><option value="Sick">Sick</option><option value="FullTime">FullTime</option><option value="Part-Time">Part-Time</option></select><select name="w_45674567_sch" class="small" onchange="PBSchChange(45674567);"><option value="Vacation">Vacation</option><option value="Sick">Sick</option><option value="FullTime">FullTime</option><option value="Part-Time">Part-Time</option></select></form></body></html>

Posted

$oIE = _IE_Example ("site")
$oInputs = _IETagNameGetCollection ($oIE, "select") ;that will get all select objects
For $oInput In $oInputs
    ;lets say you want to set this one - "w_6786455_sch" to "sick"
    If $oInput.name="w_6786455_sch" then _IEFormElementOptionselect($oInput,"Sick",1,"byValue")
Next

Check this out.

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
  • Recently Browsing   0 members

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