Jump to content

IE.au3


Recommended Posts

Well, this newbie has made it past the second Tutorial, and already worked out how to write a GUI applet to get to a web-page, but got stuck at the point where I wanted to insert some text (a variable from an edit control in my GUI) into an input form. The Windows Info tool doesn't give any information I could understand about the browser window. The mouse coordinates it indicated didn't correspond to where the mouse cursor ended up when I positioned it at those coordinates. I counted the number of manual Tab presses needed to get from the home page to the input form (16) and sent 16 Tabs. Nope, all that did was somehow take me to a different part of the site. My blind friend in Sacramento who has to navigate by tabbing through every control, link, image, advertisement etc on a web page, waiting for the speech synthesiser to tell her what it is, just to get to the useful bit, has my every sympathy. I'm hoping to write a few useful scripts for her, to get her straight to what she needs, and indeed read and copy it into a more friendly form offline.

Then I discovered IE.au3 and even though it's another of those cases where you can't learn it if you don't already know all those obscure IE-related terms the documentation is talking about, it looks fairly hopeful. So I tried the first example, copying and pasting the code below into SciTE and saving it. And it didn't work. The function _IEClickLinkByText is an unknown function name, it says. But I can see it in the IE.au3 file, which is in my autoit\include folder. This is typical of the basic problems that plague me all the time and doubtless is why I may sound just a little bit frustrated now and again. I suspect the other UDFs are equally unknown but as the applet stops at the first one, I can't tell.

#cs
   This sample code will:
   1) Create a new browser window
   2) Navigate to http://www.autoitscript.com
   3) click on the 'forum' link
   4) click on the 'Search' link
   5) get the object reference for the form named 'sForm'
   6) get the object reference for the form field 'keywords' in the form 'sForm'
   7) enter the value 'ReadyState' into the 'keywords' field
   8) submit the form to return the search results
#ce

#include "C:\Program Files\AutoIt3\Include\IE.au3" ; I tried this as an alternative to the original #include <IE.au3>
                                                                           ; I also tried copying IE.au3 into the directory where the script is located
$o_IE = _IECreate ()
_IENavigate ($o_IE, "http://autoitscript.com")
_IEClickLinkByText ($o_IE, "forum")                    ; app stops here
_IEClickLinkByText ($o_IE, "Search")
$o_SearchForm = _IEFormGetObjByName ($o_IE, "sForm")
$o_Keywords = _IEFormElementGetObjByName ($o_SearchForm, "keywords")
_IEFormElementSetValue ($o_Keywords, "ReadyState")
_IEFormSubmit ($o_SearchForm)

So, can anyone kindly suggest why the function I can see with my own eyes in the right file in the right folder is deemed "unknown"?

Second, is it in fact possible to use these UDFs to type text into a form control in an .asp page, send Enter and after a pause tab on to the controls where the results should come up, then copy the results back to the edit boxes in the AutoIt GUI applet? Or am I wasting my time trying to understand them? Be honest, please. If it's possible and there are examples that work, I should get there under my own steam.

Thanks

Caravelle

Link to comment
Share on other sites

Sorry, that is an old example. _IEClickLink* is now _IELinkClick*.

Suggest you start with the examples in the helpfile -- I worked hard to make them all standalone examples so that they work just the way they are written so that they would be good learning tools.

You should be able to do all of the things that you mention with IE.au3, but perhaps not exactly the way you think it will work -- again, suggest you work through the helpfile.

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

Dale wrote:

Suggest you start with the examples in the helpfile

Thanks Dale. I was looking at the file "Examples.txt" that goes with IE.au3 in the "Ultimate AutoIt Scripts Collection" download.

You should be able to do all of the things that you mention with IE.au3

Good news.

but perhaps not exactly the way you think it will work

That's par for the course, then. But can you point to an example in the helpfile (you mean the AutoIt3 Help, I presume) which gives a clue about the way it does work?

A lot of people would save a lot of time going down blind alleys if there was a commented example for, eg, posting a zipcode query at http://zip4.usps.com/zip4/welcome.jsp, and retrieving the result. And it might actually be a practically useful script. The main sites I'm interested are far more obscure and members-only so it wouldn't be a case of doing my work for me.

Caravelle

Link to comment
Share on other sites

See the examples for _IEFormElementSetValue and _IEFormElementGetValue

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

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