Sign in to follow this  
Followers 0
yarsye

How to get the object IE window by click link

12 posts in this topic

I simulate a mouse click to open another IE winodw by _IEFormImageClick(), and I want to operate the IE window, how can I get the object of the last opened window

Share this post


Link to post
Share on other sites



If you can precict anything about the new IE window, look at the options for _IEAttach

If not, you'll need to learn about events and set up your own newwindow event handler.

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

One clumsy thing that you can try if you cant is to get all the IE windows before , then get all the IE windows after , and then just substract and the 1 window that is left should be the new IE window. That is of course if you cant identify the new window by other means as Dale suggested of course.

Share this post


Link to post
Share on other sites

Anyone could give me a demo code? thanks a lot

Share this post


Link to post
Share on other sites

Please post your _IEFormImageClick code and i can try to help. I guess you are clicking always on the same input type image right?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <IE.au3>
$oIE = _IECreate ("http://www.creative.com/language.asp", 0,1, 1, 1)

$oForm = _IEFormGetObjByName ($oIE, "langsel")

$oRegionName = _IEFormElementGetObjByName ($oForm, "Region")
_IEFormElementOptionselect ($oRegionName, 1, 1, "byIndex")

$oCountryName = _IEFormElementGetObjByName ($oForm, "Country")
_IEFormElementOptionselect ($oCountryName, 22, 1, "byIndex")

_IEFormElementCheckboxSelect ($oForm, "1", "Checkbox1", 1, "byValue")

_IEFormImageClick($oForm, "Image1", "name")


;Open Home page
_IELinkClickByText($oIE,"Home")

Till now, the last line have no effect.

How I can operate the IE window after the www.sg.creative.com page has loaded?

Edited by yarsye

Share this post


Link to post
Share on other sites

You were not opening a new window. You were simply navigating to a new location - you may have known what you meant, but you used the wrong words.

Your trouble is actually caused the the built in _IELoadWait (see the remarks for _IEFormSubmit which explains a commin issue there).

Just change your _IEFormImageClick and add your own _IELoadWait like this:

_IEFormImageClick($oForm, "Image1", "name", 0, 0)

_IELoadWait($oIE)

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

#8 ·  Posted (edited)

Thanks for Dale's reply.

Yes, my demo code is in same IE window, and I have got this demo.

But I wanna know how to operate the IE window in the situstion that an new IE window lanunched after click a link when I post this topic. I thought the object has not changed if click link in the same window, so I wanna know the sistuation if it opened a new IE window? The object has changed if in a new IE window ,isn't it?

Edited by yarsye

Share this post


Link to post
Share on other sites

Is it always gona be the same new window or it could be different windows?

Share this post


Link to post
Share on other sites

I can't imagine why you wasted our time with demo code, got and answer and then said thanks, but you didn't answer my real question that had nothing to do with the demo code I posted.


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

Sorry Dale, I thought I haven't explain my ideas clearly.

My purpose for posting this topic is want to konw how to get the object IE winodw which by click link.

I known the demo my posted is in the same window, is not same the title . I wanna know the 2 solutions to operate IE window which open web-link in same window and open in a new window.

When I posted my demo code , I wanna to fix the demo first , then focus on the situation which open web-link in a new window, thanks for Dale 's reply, I fixed the demo when I use the _IELoadWait($oIE) function which you told me, and till now I have known the solution which open web-link in same window, but refer to the topic title, I still puzzled by the situation which open web-link in a new window.

Am I explained my ideas clearly? Hope your reply, thank you in advance.

Share this post


Link to post
Share on other sites

When it opens a new window, use _IEAttach to get a reference to the new window.

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

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