Jump to content

For loop question


Recommended Posts

<INPUT id=OidTB1.2.31 onchange=setEcam(this) value=5.00 size=8 name=OidTB1.2.31>

<INPUT onchange=setEcam(this) value=0.00 name=OidTB1.2.21>

$fps = _IETagNameGetCollection($oIE, "INPUT")

$sts = _IETagNameGetCollection($oIE, "INPUT")

For $st in $sts
;for $i = 0 to 2 step 1
        If String($st.name) = "OidTB1.2.21" Then
                for $fp in $fps
                    if String($fp.id) = "OidTB1.2.31" Then
                        _IEFormElementSetValue($fp, "5")
                        MsgBox(0,"test", "Got Here0")
                        Sleep(1000)
                        _IEFormElementSetValue  ($st, "0")
                        MsgBox(0,"test", "Got Here1")
                        Sleep(1000)
                        _IEFormElementSetValue($fp, "10")
                        MsgBox(0,"test", "Got Here2")
                        Sleep(1000)
                        _IEFormElementSetValue  ($st, "0.75")
                        MsgBox(0,"test", "Got Here3")
                        Sleep(1000)
                        _IEFormElementSetValue($fp, "0")
                        MsgBox(0,"test", "Got Here4")
                        Sleep(1000)
                        _IEFormElementSetValue  ($st, "1.5")
                        MsgBox(0,"test", "Got Here5")
                        Sleep(1000)
                        _IEFormElementSetValue($fp, "5")
                        MsgBox(0,"test", "Got Here6")
                        Sleep(1000)
                        _IEFormElementSetValue  ($st, "1.99")
                        MsgBox(0,"test", "Got Here7")
                        Sleep(1000)
                    EndIf
                Next
        EndIf
        
;Next
Next

C:\Program Files\AutoIt3\Examples\Helpfile\iqtest.au3 (440) : ==> The requested action with this object has failed.:

if String($fp.id) = "OidTB1.2.31" Then

if String($fp.id^ ERROR

->12:19:14 AutoIT3.exe ended.rc:1

what is wrong with the function above, Any help???

Edited by diikee
Link to comment
Share on other sites

<INPUT id=OidTB1.2.31 onchange=setEcam(this) value=5.00 size=8 name=OidTB1.2.31>

<INPUT onchange=setEcam(this) value=0.00 name=OidTB1.2.21>

C:\Program Files\AutoIt3\Examples\Helpfile\iqtest.au3 (440) : ==> The requested action with this object has failed.: 
if String($fp.id) = "OidTB1.2.31" Then 
if String($fp.id^ ERROR
->12:19:14 AutoIT3.exe ended.rc:1

what is wrong with the function above, Any help???

Please put "code, /code" tags around your code to preserve indentation, and forget you ever saw color tags!

What was this supposed to do? Both $sts and $fps contain the exact same collections, so what is the nesting for?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The nesting is for populating one text box after the other one

I want toggle between the 2 txt boxes which are distinguished by name which has different name

Edited by diikee
Link to comment
Share on other sites

for $st in $sts 
    for $i = 1 to 15 step 3
        If String($st.name) = "OidTB1.2.31" Then
            _IEFormElementSetValue($st, "" & $i, 1)
            sleep(6000)
            
        EndIf
    Next
Next

If I use the $f_fireEvent=0 the settings increment by 3 but onchange is not initiated

whereas

If I use the $f_fireEvent=1 the the value = 1 is set in the textbox and onchange is initiated, but it never increments to 4

rather errors with

C:\Program Files\AutoIt3\Examples\Helpfile\iqtest.au3 (394) : ==> The requested action with this object has failed.:

If String($st.name) = "OidTB1.2.31" Then

If String($st.name^ ERROR

->15:20:58 AutoIT3.exe ended.rc:1

Link to comment
Share on other sites

<TD class=input>max frame rate (fps) <INPUT id=OidTB1.2.31 onchange=setEcam(this) value=10.00 size=8 name=OidTB1.2.31></TD>

$sts = _IETagNameGetCollection($oIE, "input")

for $st in $sts 
;for $i = 5 to 15 step 3
    ;If String($st.id) = "OidTB1.2.31" Then
            if String($st.type) = "text" Then
            ;if String(_IEPropertyGet($st, "name")) = "OidTB1.2.31" Then
                    if String($st.name) = "OidTB1.2.31" Then
                ;_IEFormElementSetValue($st, "" & $i, 1)
                    _IEFormElementSetValue($st, "10{TAB}")
                    _IELoadWait($oIE)
                    Sleep(1000)
                    _IEFormElementSetValue($st, "5{TAB}")
                    _IELoadWait($oIE)
                    Sleep(1000)
                    _IEFormElementSetValue($st, "8{TAB}")
                    _IELoadWait($oIE)
                ;_IEFormElementSetValue($st.value, "10")
                ;_IELoadWait($oIE)
                ;Sleep(5000)
                EndIf
            EndIf
                    
    ;EndIf
;Next

if String($st.type) = "text" Then

if String($st.type^ ERROR

Can someone take a peek at this???

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...