Jump to content

_IE array


someone
 Share

Recommended Posts

Hey everyone,

What I'm trying to do is make an array out of an IEForm Element (in specific an array out of a drop down menu's text) and then search in that array for a string. Say the dropdown menu is of countries, I want to select USA based on a string of just the letter S. Obviously there are lots of countries the letter S but you get the point.

I don't mean for this post to come off as being needy or asking people to write the code for me I just don't know what the best way to approach writing the script is.

Any advice or example scripts would help a lot

Thanks

Andrew

PS. Someone answer this before DaleHohm, if he answers anymore of my _IE.au3 questions he's gonna start charging me... ;)

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

How about something like:

_IEFormElementGetCollection($oForm)
For $i = 0 to (@extended - 1)
    $oElement = _IEFormElementGetCollection($oForm, $i)
    $array[$i] = _IEFormElementGetValue($oElement)
Next
; work out your selection based on strings here

Not sure if that will work for you, but it might give you some ideas.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

A SELECT element is a strange one that has an Options collection nested in it.

$oSelect = _IETagNameGetCollection($oIE, "select", 0)
$oOptions = $oSelect.options
For $oOption in $oOptions
    ConsoleWrite($oOption.value & " : " & $oOption.text & " : " & $oOption.selected & @CR)
Next

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

Link to comment
Share on other sites

A SELECT element is a strange one that has an Options collection nested in it.

$oSelect = _IETagNameGetCollection($oIE, "select", 0)
$oOptions = $oSelect.options
For $oOption in $oOptions
    ConsoleWrite($oOption.value & " : " & $oOption.text & " : " & $oOption.selected & @CR)
Next

Dale

Edit: typo

Thanks to both of you for the help and the fast reply. How do I choose which select tag to use? Theres about 5 on the page, and it returns the first. Is it @extended? If so can you give an example I'm having a little confusion using that properly. Thanks
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

Thanks to both of you for the help and the fast reply. How do I choose which select tag to use? Theres about 5 on the page, and it returns the first. Is it @extended? If so can you give an example I'm having a little confusion using that properly. Thanks

It's already choosing the first 'select' tag it's coming across is it not? The index value in the collection is 0, ie. first tag? Or are you referring to selecting the correct option now?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

It's already choosing the first 'select' tag it's coming across is it not? The index value in the collection is 0, ie. first tag? Or are you referring to selecting the correct option now?

I'm such a idiot sometimes... I don't know why I must have done something small wrong when I changed the 0 to a different number... sorry but thanks a lot Mike, your always a good help

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

lol...Happy to help. Everyone makes mistakes, except for Chuck Norris.

Yep, just when you thought the Chuck fad was over...

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...