Jump to content

Issue with Winexists in IE.


Recommended Posts

Please Help. When i perform a certain action either of the two windows appear.

1st Window

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"><head><title>Internet Access</title></head><body bgcolor="#ffffff">

<table bgcolor="#336600" height="10%" width="100%">

<tbody><tr><td align="center" width="100%"><font color="white" size="6">Broadband Internet Access</font></td>

</tr><tr>

</tr></tbody></table>

<br><br><br>

<center>

<font color="#003333" size="4">You have successfully logged out.</font>

<br><br><font color="#003333" size="4">Please click </font><a href="http://mptadsl.net.mm/WGarden/Popup.php">here </a><font color="#003333" size="4">to reconnect again.</font><br></center></body></html>

2nd Window

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"><head><title>Internet Access</title></head><body bgcolor="#ffffff">

<table bgcolor="#336600" height="10%" width="100%">

<tbody><tr><td align="center" width="100%"><font color="white" size="6">Broadband Internet Access</font></td>

</tr><tr>

</tr></tbody></table>

<table bgcolor="#336600" height="7%" width="100%">

<tbody><tr><td align="left" width="50%"><font color="white">Login Time-2:10:40</font></td></tr></tbody></table><table height="7%" width="100%">

<tbody><tr><td align="center" width="50%"><font color="#003333" size="4">Welcome <font style="text-transform: capitalize;" ;=""><b>tcil_1,</b></font></font></td>

</tr><tr><td align="center" width="50%"><font color="#003333" size="4">You are now connected to Internet!</font></td></tr>

</tbody></table><br><table align="center" border="1" frame="box" height="7%" rules="none" width="70%"><tbody><tr><td align="left"><font color="#003333"><b>*</b> Open a 'New Window' for browsing. </font></td></tr><tr><td align="left"><font color="#003333"><b>*</b> Please minimize or leave this window open for you to logout.</font></td></tr><tr><td align="left"><font color="#003333"><b>*</b> If incase you close this window accidentally, please login once again and you will be redirected to the logout window. </font></td></tr></tbody></table><br><br>

<form name="form1" action="RadClient.cgi" method="post">

<input value="tcil_1" name="username" type="hidden">

<input value="172.24.2.251" name="clientIp" type="hidden">

<center><font color="#003333">Click on the Logout button to disconnect.</font></center>

<font color="#003333"> <br></font><center><font color="#003333"><input value="LogOut" name="Submit" style="background-color: rgb(51, 102, 0); color: white;" type="submit"></font></center><font color="#003333"><br> <table bgcolor="#336600" height="10%" width="100%"><tbody><tr><td> </td></tr><tr><td> </td></tr><tr><td> </td></tr><tr><td></td></tr></tbody></table></font></form></body></html>

I want to perform different actions based on which window loads but how to do it as the title of both windows are same. I tried using

CODE
if Winexists("Internet Access", "Welcome" ) Then ......something

but it did not work

Please help.

Link to comment
Share on other sites

Window Title and Document Title aren't synonymous...the title of the document you see in the source doesn't necessarily mean the same thing as the title of the window. That said, a simple way to check which page you are on is to look for some text from the page and do something according to what you read.

#include <IE.au3>

$url = "yourUrlHere"
$oIE = _IECreate($url, 1, 0)
$HTML = _IEBodyReadText($oIE)
If StringInStr($HTML, "You have successfully logged out.") Then
    ;do something
ElseIf StringInStr($HTML, "You are now connected to Internet!") Then
    ;do something
Else
    ;error handling
EndIf
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Window Title and Document Title aren't synonymous...the title of the document you see in the source doesn't necessarily mean the same thing as the title of the window. That said, a simple way to check which page you are on is to look for some text from the page and do something according to what you read.

#include <IE.au3>

$url = "yourUrlHere"
$oIE = _IECreate($url, 1, 0)
$HTML = _IEBodyReadText($oIE)
If StringInStr($HTML, "You have successfully logged out.") Then
    ;do something
ElseIf StringInStr($HTML, "You are now connected to Internet!") Then
    ;do something
Else
    ;error handling
EndIf
Thanks a lot for the help
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...