Jump to content

_IEAttach doesn't work


Recommended Posts

Here is small reproducing script:

#include <IE.au3>

ShellExecute('www.google.com')
WinWait("Microsoft Internet Explorer")

$oIE = _IEAttach("Microsoft Internet Explorer")
If @error Then     MsgBox(0,'_IEAttach error', @error)

It always show messagebox with @error=7 (No Match)

I tested sources of _IEAttach() and there is problem with $o_window.document.title which returns empty string

$o_window.type returns 'Dokument HTML'

So this condition is false and this is source of problem

If StringInStr($o_window.document.title, $s_string) > 0 Then

EDIT: On Win7 must be used titile Windows Internet Explorer

EDIT2: In fact I test it on IE window opened by hand without ShellExecute() + WinWait()

Edited by Zedna
Link to comment
Share on other sites

I think it can be because there is IE object used in another application (as embedded object) for example Outlook or maybe also Word and this instance of IE has empty title.

_IEAttach has implicit $i_instance = 1 parameter so if first IE has empty title then it probably stop searching other ones.

I will do some more tests if that;s the case...

Link to comment
Share on other sites

@Zedna - _IEAttach, by default looks for the "Document Title". In your case, this is "Google", not "Microsoft Internet Explorer". "Microsoft Internet Explorer" is appended to the document title to create the Window Title (note - that string changes based on the version of IE, so be careful).

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

@Zedna - _IEAttach, by default looks for the "Document Title".  In your case, this is "Google", not "Microsoft Internet Explorer".  "Microsoft Internet Explorer" is appended to the document title to create the Window Title (note - that string changes based on the version of IE, so be careful).

Dale

OK. That's probably source of my problems.

I made renamed local copy of _IEAttach() and added some ConsoleWrite() to see where it's going and what are some values.

I was confused because $o_window.document.title was empty string.

Tommorow I will do some more tests to see if it will work with Title without " - Microsoft Internet Explorer"

Thanks to all for help!

Edited by Zedna
Link to comment
Share on other sites

OK. That's probably source of my problems.

I made renamed local copy of _IEAttach() and added some ConsoleWrite() to see where it's going and what are some values.

I was confused because $o_window.document.title was empty string.

I discovered there is really $o_window.document.title empty when you have opened about:blank page in IE

In this case you can use workaround with HWND

$oIE = _IEAttach("Some title")
If @error Then     MsgBox(0,'_IEAttach error', @error) ; error=7

$hwnd = WinGetHandle("Some title")
$oIE = _IEAttach($hwnd, "HWND")
If @error Then     MsgBox(0,'_IEAttach error', @error) ; OK
Edited by Zedna
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...