Sign in to follow this  
Followers 0
cheeseslice

help referencing new windows created using _IE

6 posts in this topic

Hi,

This is probably quite simple but I can't seem to get anything to work for me. I'm writing this code for intranet pages so I'm just going to put in any old url's to explain what I mean.

The script creates a new window and logs in:

$oIE=_IECreate("www.google.com",1,1,1,1)
_IELoadWait($oIE)


$oForm = _IEGetObjByName($oIE,"login")

$oUsername = _IEFormElementGetObjByName ($oForm, "name")
_IEFormElementSetValue ($oUsername, $username)

$oPassword = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oPassword, $password)

_IEFormSubmit ($oForm,1)
_IELoadWait($oIE)

_IELinkClickByText($oIE,"some link")
_IELoadWait($oIE)

When I click on the link it will open the page in a new window (this is where I am getting lost) and I want to have control over this window. So I think my question is, how do I reference this new window rather than the original $oIE window that I opened?

I have tried using _IEAttach and using the url of the new window but this doesn't seem to be working, I have also tried chaning the code to

$oIE2=_IELinkClickByText($oIE,"some link")
so that I could then reference $oIE2 instead, but that doesnt seem to work either. I need to get the url of the new page and some text from the body, to do this I was using _IEPropertyGEt but it is just returning a zero when I output it to a msgbox.

I hope this makes some sense.

Thanks in advance

Share this post


Link to post
Share on other sites



_IEAttach is the way to go , but i dont see where you create a new window.

If submitting the form is opening new window then use _IEAttach.

Share this post


Link to post
Share on other sites

_IEAttach is the way to go , but i dont see where you create a new window.

If submitting the form is opening new window then use _IEAttach.

Hi,

Once the form submits, it waits to load and then the links appear. I then use _IELinkClickByText($oIE,"some link") to click on the link that I need which opens in a new browser window. I have been playing about with _IEAttach some more and I think the problem might be that it is not waiting for the page to fully load before it runs, which is why I can't get it to attach properly.

Thanks

Share this post


Link to post
Share on other sites

Thanks for all the replies, I managed to get it working. For some reason the only way I can get _IEAttach to work is by using instance, don't really know why this is working and it wasn't before but I don't mind!

Thanks again

Share this post


Link to post
Share on other sites

That is why you use something like this:

For $i=0 To 15 step 1
        $oIE =_IEAttach($atachadres,"url")
        If $oIE <> 0 Then ExitLoop
        Sleep(1000)
    Next

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