Jump to content

Ie.au3 T2.0 Internet Explorer Automation Library


DaleHohm
 Share

Recommended Posts

  • Replies 252
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

No. The error is in the IE.au3 library, not in the users code.

If you can replace the version of the IE.au3, make zero changes to the user's code but suddenly your code works, then there's a problem with the libary (I'm not aware that the _IEFormElementGetObjByName function is deliberately behaving differently). There shouldn't be an error to be trapping in the first place.

Come on guys, work with me here to debug this. Your comments are a little harsh.

In fact the behavior of that function is deliberately different in this version as I am trying to return the number of form elements of the same name in @extended - it appears that this is where there may be a problem.

Using the code provided however I cannot reproduce the errors. Can you provide any more information to help me reproduce or can you pride a simpler example?

Thanks,

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

Thanks will try this. More comments welcome. :D

This release gives you a simple way of enabling a COM error handler... simple add this line:

_IEErrorHandlerRegister()

The error will be trapped and a diagnostic message will be written to the SciTe console.

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

Come on guys, work with me here to debug this. Your comments are a little harsh.

hehehe. Not deliberately. We love you still

Using the code provided however I cannot reproduce the errors. Can you provide any more information to help me reproduce or can you pride a simpler example?

Of course! Here you go.

;#include <IE.au3>; T2.0-0
#include <IE2.au3>; T2.0-2

$browser=_IECreate("google.com")
$form=_IEFormGetCollection($browser,0)
$element=_IEFormElementGetObjByName($form,"q")
_IEFormElementSetValue($element,"fill me in")

The first two lines allow you to switch between the different versions of IE.au3. T2.0-0 works, whereas T2.0-2 gives you the error.

Link to comment
Share on other sites

hehehe. Not deliberately. We love you still

Of course! Here you go.

;#include <IE.au3>; T2.0-0
#include <IE2.au3>; T2.0-2

$browser=_IECreate("google.com")
$form=_IEFormGetCollection($browser,0)
$element=_IEFormElementGetObjByName($form,"q")
_IEFormElementSetValue($element,"fill me in")

The first two lines allow you to switch between the different versions of IE.au3. T2.0-0 works, whereas T2.0-2 gives you the error.

Thanks.

OK, found the error with _IEFormElementGetObjByName() -- unfortunately I replicated the same logic to several functions. Turns out there is not error in the rare case that there actually is more than one form element of the same name. I need a little more conditional logic. New version posted soon.

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

OK, found the error with _IEFormElementGetObjByName() -- unfortunately I replicated the same logic to several functions. Turns out there is not error in the rare case that there actually is more than one form element of the same name. I need a little more conditional logic. New version posted soon.

Happy hunting!

Thanks for your rapid response.

Link to comment
Share on other sites

T2.0-3 is now posted.

Fixed serious bungles in _IEFrameGetObjByName, _IEFormElementGetObjByName and _IELinkClickByIndex

Sorry for the trouble and thanks to those who helped with debugging.

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

I just wanted to post a little something I found to be totally cool

I am using the IE.au3 to create a script that will log into a web site every few minutes and read the text off the page to verify that it works properly. This is for monitoring purposes.

BUT. The cool part is that It's run via the Local System Account while the server is logged off. As long as you keep everything you do within the IE.au3 commands it works great...

I also use the hidden command when I launch the browser just incase someone is logged into the server when it's running.

$oIE = _IECreate("www.MyTestSite.com", 0, 0, 1, 0)

Thanks again Dale for the IE.au3

Mike

Link to comment
Share on other sites

Ok ptrex, this works. The about:blank issue appears to be a JAVA plugin bug. This workaround requires a blank file on disk, but you can actually attach to any valid URL. What a waste of time, but I feel vindicated.

#include <IE.au3>
$sHTML = _
    '<HTML><HEAD><TITLE>Bubbles</TITLE></HEAD><BODY>' & _
    '<APPLET ' & _
    'CODEBASE="http://java.sun.com/applets/other/Bubbles/classes" ' & _
    'CODE="Bubbles.class" WIDTH=500 HEIGHT=500 ALIGN=MIDDLE>' & _
    '</APPLET>' & _
    '</BODY></HTML>'
$oIE = _IECreate("c:\blank.htm")
_IEBodyWriteHTML($oIE,$sHTML)

Dale

Hi Dale, did not follow the thread, so I may be out of line....

but I tried this:

#include <IET203.au3>

$sHTML = _

'<APPLET ' & _

'CODEBASE="http://java.sun.com/applets/other/Bubbles/classes" ' & _

'CODE="Bubbles.class" WIDTH=500 HEIGHT=500 ALIGN=MIDDLE>' & _

'</APPLET>'

$oIE = _IECreate("about: blank.htm")

_IEBodyWriteHTML($oIE,$sHTML)

... works like a charm... XP|SP2 etc.

Must say:

watch: the space after "about:" !!!

the url now looks like: about:%20blank.htm

Hope it helps! ?

Harry

Edited by heibel
Link to comment
Share on other sites

I posted in the wrong place so I am reposting it here.

I'm not sure if this is the correct spot to ask this question but, once the image is clicked on then a prompt comes up saying ok or cancel and it seems that it is waiting until the prompt is clicked on cause once I manually click it or hit enter, then mouse then moves. Is there anyway to click on the prompt or hit enter?

#include<IE.au3>
; Set Variables
;==============================================
$pass = "putyourshere"
$email = "putyourshere"

;==============================================
; End Veriables
Dim $oIE
$Url = "www.myspace.com"

_IEAttach ($oIE)
If Not IsObj($oIE) Then
    $oIE = _IECreate ()
_IENavigate ($oIE, $Url)
EndIf

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByIndex($oIE, 1)
$o_name = _IEFormElementGetObjByName($o_form, "email")
$o_to = _IEFormElementGetObjByName($o_form, "password")


; ****Login****
_IEFormElementSetValue($o_name, $email)
_IEFormElementSetValue($o_to, $pass)
Sleep(2000)
_IEFormSubmit($o_form)
; ****End loging****
Sleep(2000)


_IEClickLinkByText($oIE, "friend requests")

$o_form = _IEFormGetObjByIndex($oIE, 3)
$o_name = _IEFormElementGetObjByName($o_form, "selectAll")
$o_name.click
_IEFormImageClick($o_form, "http://x.myspace.com/images/mail/approveSelected.gif")
MouseMove(460, 431)
MouseClick("left")
Link to comment
Share on other sites

  • Moderators

I posted in the wrong place so I am reposting it here.

I'm not sure if this is the correct spot to ask this question but, once the image is clicked on then a prompt comes up saying ok or cancel and it seems that it is waiting until the prompt is clicked on cause once I manually click it or hit enter, then mouse then moves. Is there anyway to click on the prompt or hit enter?

This should get you started:

#include<IE.au3>
; Set Variables
;==============================================
$pass = "putyourshere"
$email = "putyourshere"

;==============================================
; End Veriables
Dim $oIE
$Url = "www.myspace.com"

$oIE = _IEAttach ($Url, "url")

If Not IsObj($oIE) Then
    $oIE = _IECreate ($Url)
EndIf

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByIndex ($oIE, 1)
$o_name = _IEFormElementGetObjByName ($o_form, "email")
$o_to = _IEFormElementGetObjByName ($o_form, "password")


; ****Login****
_IEFormElementSetValue ($o_name, $email)
_IEFormElementSetValue ($o_to, $pass)
Sleep(2000)
_IEFormSubmit ($o_form)
; ****End loging****
Sleep(2000)


_IEClickLinkByText ($oIE, "friend requests")

$o_form = _IEFormGetObjByIndex ($oIE, 3)
$o_name = _IEFormElementGetObjByName ($o_form, "selectAll")
$o_name.click
_IEFormImageClick ($o_form, "http://x.myspace.com/images/mail/approveSelected.gif")
$oDialogBox = _IEAttach ("Title of the dialogbox", "DialogBox")
; i don't have an example so this is as far as i can go
MouseMove(460, 431)
MouseClick("left")
Edited by big_daddy
Link to comment
Share on other sites

Hey guys, I just installed IE 7 Beta 2 and the UDF didn't seen to work right, has this been tested on that or is it just for 6?

I uninstalled it because I would rather have the UDF than the new IE

Thanks

~zero

No testing has been done with IE7. I don't expect it to be difficult to make it compatible with both IE6 and IE7 though, so I'll be interested in specifics from anyone who tries it. I'll get around to it, but not quite yet.

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

I posted in the wrong place so I am reposting it here.

I'm not sure if this is the correct spot to ask this question but, once the image is clicked on then a prompt comes up saying ok or cancel and it seems that it is waiting until the prompt is clicked on cause once I manually click it or hit enter, then mouse then moves. Is there anyway to click on the prompt or hit enter?

The catch22 is that once the dialog is triggered, the script is paused waiting for response (this is the same thing that would happen if your script were all in the browser in Javascript). In order to have AutoIt freed up to click on the dialog you need to work in parallel.

This can be done by using a combination of AutoIt and IE.au3 techniques.

First get a reference to the object you want to click on -- let's call it $oImage. Then to a $oImage.focus and then an AutoIt Send("{Enter}") -- your script is not held up by the dialog that appears and you can then do a WinWait for the dialog and then deal with it via AutoIt commands.

Make sense?

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

Ya, it makes perfect since, but I am totally new to autoit and scripting with it so I do not know the commands. Could you help out a lil bit and get me started off in the right direction?

Thanks

There are a bunch of examples for IE.au3 T1.0 here One of them is an example of filling out a Google seach for and uses this same technique (look for .focus).

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

No testing has been done with IE7. I don't expect it to be difficult to make it compatible with both IE6 and IE7 though, so I'll be interested in specifics from anyone who tries it. I'll get around to it, but not quite yet.

Dale

OK, so I've now loaded IE7 Beta 2 on a test machine.

I've run a bunch of example code and so far everything works flawlessly.

Please test and report details of any trouble that you have. Based on my experience so far I don't expect much trouble and expect that changes to support IE7 will be minor.

Please test and send me any issues you encounter.

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