Jump to content

[SOLVED]-->looping problem-->Thanks to PsaltyDS


Recommended Posts

<TD class=input>max frame rate (fps)

<INPUT id=OidTB1.2.31 onchange=setEcam(this)

value=5.00 size=8 name=OidTB1.2.31></TD>

$osps = _IETagnameGetCollection($oIE, "input")
For $osp in $osps
    If String($osp.name) = "OidTB1.2.31" Then
        
        _IEFormElementSetValue($osp, "5.00") --->> this gets set
        Sleep(6000)
        _IEFormElementSetValue($osp, "10.00") --->>this doesn't get set and I get the error below
        Sleep(5000)
        ExitLoop
        
    EndIf
Next

Console output

--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType

what am I doing wrong?? I basically want to loop through 0 to 20.

Edited by diikee
Link to comment
Share on other sites

try

$i = 0
$osps = _IETagnameGetCollection($oIE, "input")
For $osp in $osps
    If String($osp.name) = "OidTB1.2.31"  and $i < 21 Then
        
        _IEFormElementSetValue($osp, "5.00")
        Sleep(6000)
        _IEFormElementSetValue($osp, "10.00") 
        Sleep(5000)
       $i += 1
    Else
              exitloop
    EndIf
Next

:)

Edited by torels

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

torels, tried your suggestion but got same error...Something to do with name/id

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

If String($osp.name) = "OidTB1.2.31" and $i < 21 Then

If String($osp.name^ ERROR

Link to comment
Share on other sites

$ofps = _IETagnameGetCollection($oIE, "input")
For $spt = 5 to 60 Step 10
    For $ofp in $ofps
        If String($ofp.name) = "OidTB1.2.31" Then
            _IEFormElementSetValue($ofp, $spt) --->(5 gets set but not 15)
            Sleep(6000)
            ExitLoop -->Exits successfully without iterating from 5 to 60
            _IEFormElementSetValue($ofp, "unlimited") --> This never gets executed
        EndIf
    Next
Next

Can someone see what I am doing wrong or missing??

Edited by diikee
Link to comment
Share on other sites

<TD class=input>max frame rate (fps)

<INPUT id=OidTB1.2.31 onchange=setEcam(this)

value=5.00 size=8 name=OidTB1.2.31></TD>

_IEFormElementSetValue($osp, "5.00") --->> this gets set
        Sleep(6000)
        _IEFormElementSetValue($osp, "10.00") --->>this doesn't get set and I get the error below

Console output

--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType

what am I doing wrong?? I basically want to loop through 0 to 20.

What happens in the intervening six seconds? Does the page change? If so, the $osp object reference may not be valid any more. If a script action occurs on detecting the first entry, it may recreate the element, which would again invalidate the old object reference.

If the above is true, you will have to re-acquire the object reference each time you want to set the value.

:)

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

Even though the object reference might change due to the onchange() script, the id or name doesn't change and it should be able to re-acquire automatically.

look at this

Sleep(2000)
$lg = _IETagNameGetCollection($oIE, "SELECT")
For $l in $ag 
    If String($l.name) = "OidSB1.2.30" Then
        _IEFormElementOptionselect($l, "4x", 1, "byText") [color="#0000FF"]--->Gets set ok[/color]
        Sleep(6000)
    EndIf
Next
Sleep(2000)
$lg = _IETagNameGetCollection($oIE, "SELECT")
For $l in $ag 
    If String($l.name) = "OidSB1.2.30" Then [color="#FF0000"]----->>Errors out here[/color]
        
        _IEFormElementOptionselect($l, "disabled", 1, "byText")
        Sleep(3000)
    EndIf
Next
Sleep(2000)

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

If String($l.name) = "OidSB1.2.30" Then

If String($l.name^ ERROR

8 seconds is long enough for it to reacquire the reference object??

Edited by diikee
Link to comment
Share on other sites

Even though the object reference might change due to the onchange() script, the id or name doesn't change and it should be able to re-acquire automatically.

No, it doesn't. Even if the exact same page gets reloaded, it will have all new object references to the DOM, forms, elements, etc.

look at this

Sleep(2000)
$lg = _IETagNameGetCollection($oIE, "SELECT")
For $l in $ag 
    If String($l.name) = "OidSB1.2.30" Then
        _IEFormElementOptionselect($l, "4x", 1, "byText") [color="#0000FF"]--->Gets set ok[/color]
        Sleep(6000)
    EndIf
Next
Sleep(2000)
$lg = _IETagNameGetCollection($oIE, "SELECT")
For $l in $ag 
    If String($l.name) = "OidSB1.2.30" Then [color="#FF0000"]----->>Errors out here[/color]
        
        _IEFormElementOptionselect($l, "disabled", 1, "byText")
        Sleep(3000)
    EndIf
Next
Sleep(2000)

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

If String($l.name) = "OidSB1.2.30" Then

If String($l.name^ ERROR

8 seconds is long enough for it to reacquire the reference object??

There is no "reacquire" if the page is reloaded. If the page is not reloaded then it's not an issue to begin with.

Is "SELECT" a valid tag? Are you getting a valid collection back? Put some error checking on your collection object before you use it.

Also, you have two collections made to $lg, then you use $ag in the For/In/Next loop? Is that a typo?

:)

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

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