Jump to content

How to detect new windows are openned..


Rota
 Share

Recommended Posts

I am facing a challenge of manipulating IE.

New window will be openned when I click button on the page, the new page might not be openned up soon as there might be some response time, in such case I supposed to place a Winwaitactivate to wait until this new page is open, while in some case such page will turn to a error page if the content doesn't exist, so ... how could I detect the new page has been openned, which then WINEXIST could help to judge first which page is openned... then I could proceed...

Please help help...

Regards

Link to comment
Share on other sites

Have you tried using SEND() and Copy a portion of the open window into clipboard, then use ClipGet() and test it for what you are looking for?

EX.

Func TEST()

Local $TEST1

WinActivate("Internet Explorer")

WinWaitActive("Internet Explorer")

DO

Send("{HOME}{TAB}+{RIGHT}+{RIGHT}+{RIGHT}!EC")

$TEST1 = ClipGet()

Until $TEST1 = "WEL" ; Suppose first three letters of text on screen is WEL (WELCOME)

EndFunc

Something like this would run until $TEST1 = what you were waiting for. Obviously the keystrokes would have to be tested manually by you first, but then once you code those proplery, it will run well.

I hope this helps!

Link to comment
Share on other sites

Have you tried using SEND() and Copy a portion of the open window into clipboard, then use ClipGet() and test it for what you are looking for?

EX.

Func TEST()

Local $TEST1

WinActivate("Internet Explorer")

WinWaitActive("Internet Explorer")

DO

Send("{HOME}{TAB}+{RIGHT}+{RIGHT}+{RIGHT}!EC")

$TEST1 = ClipGet()

Until $TEST1 = "WEL" ; Suppose first three letters of text on screen is WEL (WELCOME)

EndFunc

Something like this would run until $TEST1 = what you were waiting for. Obviously the keystrokes would have to be tested manually by you first, but then once you code those proplery, it will run well.

I hope this helps!

I also forgot to mention, you could test the TEXT of the window title until it reflects what you are looking for...

EX

Opt("WinTitleMatchMode",2 )

WinWaitActive ( "AutoIt Forums" , "Replying in How to detect new windows are openned..")

For your case, the latter solution would probably be a better choice since IE changes the text of the title based on the webpage.

The Former case was where the window title doesn't change but the contents do... Sorry for the confusion.

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