Jump to content

IEFormElementGetCollection


jdogga
 Share

Recommended Posts

Hi all,

I am using IEAttach to attach to an existing window that appears to have one form in it, with lots of links and a few text boxes.

Basically I am trying to find the object for the text box and change the value from 0 to 60 (for Refresh Rate).

Window info does nothing to tell me what element the text box is, so I am having a hard time locating it and I want to avoid mouse clicking like the plague because window size/resolution changes.

I have tried multiple things to get a collection of all the elements, but with no success.

Here is my code that successfully attaches to the window.

Any suggestions?

Thanks,

jdogga

#include <IE.au3>

$oIE = _IEAttach ("AnyQueue", "embedded")
$sMyString = "Host"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
       ;_IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")
For $oForm In $oForms
    MsgBox(0, "Form Info", $oForm.name)
;$oQuery = _IEFormElementGetCollection ($oForm, 1)
    
Next
Link to comment
Share on other sites

An update... looks like the text box I am trying to update is in a table... now the question is how to update the value and press enter.

Here is the source I found:

<input name=arrate size=2 maxlength=3 value="60" type=text>

Basically I want to change the value to 60 (from 0) and hit enter.

Link to comment
Share on other sites

$oFormElement = _IEGetObjByName($oIE, "arrate")

then use _IEFormElementSetValue

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

$oFormElement = _IEGetObjByName($oIE, "arrate")

then use _IEFormElementSetValue

Dale

Thanks Dale! You are the man!

Here is the final code that I used:

#include <IE.au3>

$oIE = _IEAttach ("AnyQueue", "embedded")
$sMyString = "Host"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
       ;_IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

$oFormElement = _IEGetObjByName($oIE, "arrate")
_IEFormElementSetValue ($oFormElement, "60")
_IEAction ($oFormElement, "focus")
Send("{ENTER}")
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...