Sign in to follow this  
Followers 0
Zedna

_IEAttach doesn't work

8 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Hi Zedna,

What version of IE do you have ?

Did you try attaching with 'url' as param?

It works for me on Vista and IE7.

This is what i tested:

ShellExecute('www.google.com')
WinWait("Google")
$oIE = _IEAttach("Google")
If @error Then     MsgBox(0,'_IEAttach error', @error)

Share this post


Link to post
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...

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

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