Sign in to follow this  
Followers 0
Falling

When using IE.au3 what is the best way to get form index #?

4 posts in this topic

$oIE = _IECreate ($URL)  
$o_form = _IEFormGetCollection ($oIE,?formindex?)

What if there is 100 forms on a page? None have id's or names.

What is the fastest way to find out the specific ID of a form on that page?

Thanks for any info!

Share this post


Link to post
Share on other sites



$oIE = _IECreate ($URL)  
$o_form = _IEFormGetCollection ($oIE,?formindex?)

What if there is 100 forms on a page? None have id's or names.

What is the fastest way to find out the specific ID of a form on that page?

Thanks for any info!

dang can this be moved to Help forum thanks.

Share this post


Link to post
Share on other sites

Each form has an index #, this is based off the source order of the forms. The first form will be index 0, the second index 1, and so forth. If none of the forms have id's or name's, then that is what you will have to use.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$oIE = _IECreate ($URL)  
$o_form = _IEFormGetCollection ($oIE,?formindex?)

What if there is 100 forms on a page? None have id's or names.

What is the fastest way to find out the specific ID of a form on that page?

Thanks for any info!

In addition to big_daddy's advice, consider that you can iterate through the items in the collection and check their properties for what you are looking for. You can find the properties documented on MSDN (see _IE_Introduction() for a pointer). For example, every form has a .action:

$oIE = _IECreate ($URL)  
$oForms = _IEFormGetCollection ($oIE)
Dim $i = 0
For $oForm in $oForms
    ConsoleWrite("Index: " & $i & " Action: " & $oForm.action
    $i = $i + 1
Next

You can also obviously check the value of $oFrom.action instead of writing it out and if it matches what you are looking for, do what you want to do with the object and ExitLoop.

Food for thought...

Dale

Edit: typo

Edited by DaleHohm

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

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
Sign in to follow this  
Followers 0