Sign in to follow this  
Followers 0
muzle6074

IE Function Help

6 posts in this topic




Broad question: How can I enter the first topic in a forum? As an example go to http://www.autoitscript.com/forum/index.php?showforum=2 and enter the first topic on the list.

I really don't know where to start :P

Study the examples in the help file for the _IE* functions. The method used would depend a great deal on the web page you are working with. If the topics are links, then you can use _IELinkGetCollection(), for example.

After you try it yourself, if you need more help, post what you've got (nobody is likely to write it for you).

:P


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

Share this post


Link to post
Share on other sites

Hi PsaltyDS,

I had a play with _IELinkGetCollection() and returned all the links on the page etc but how can I select 1 link with the collection. I tryed doing oLinks[5] (using it like an array) to pick a single link but it throws an error in the expression ;)

Any ideas how I can select a single link within the collection?

--muzle

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi PsaltyDS,

I had a play with _IELinkGetCollection() and returned all the links on the page etc but how can I select 1 link with the collection. I tryed doing oLinks[5] (using it like an array) to pick a single link but it throws an error in the expression :D

Any ideas how I can select a single link within the collection?

--muzle

It is a COM Collection Object, not an array (though it's sort of like an array).

If you know exactly which 1-based index it is, you can try: $oLinks.Item(5).

The more usual method (since you usually don't know the exact index) is to loop through the obects in the collection to find the one you want:

For $oLink In $oLinks
      If String($oLink.InnerText) = "This is it!" Then MsgBox(64, "Found", "Found link.")
Next

There are many other properties besides .InnerText to use in identifying the one you want. You'll have to determine what works in your situation.

;)

Edit: Tweaked to ensure string from .InnerText, per Dale.

Edited by PsaltyDS

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Make sure you force the attribute into a string. If you find a link with null innerText it will return integer 0 and do an integer comparison... surprise, surprise,

0 = "This is it!"

evaluates to TRUE

String(0) = "This is it!"

evaluates to FALSE

For $oLink In $oLinks
      If String($oLink.InnerText) = "This is it!" Then MsgBox(64, "Found", "Found link.")
Next

Dale

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

Thanks for the help guys! I will give this a go as soon as I get home ;)

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