Sign in to follow this  
Followers 0
IanN1990

[Solved] Detect Webpage

5 posts in this topic

#1 ·  Posted (edited)

could someone help me with some code

i am trying to get autoit detect when BBCiplayer is open in Internet Explorer.

Opt('WinTitleMatchMode', 2)
while 1
   sleep(50)
if WinGetTitle("[Class:IEFrame]") > "BBC iPlayer - " Then
   ConsoleWrite("A")
EndIf
WEnd

Kinda works but it does it for any page not just pages with BBC Iplayer in it, any ideas?

Edited by IanN1990

Share this post


Link to post
Share on other sites



Should be something like:

while 1
   sleep(50)
    if Stringleft(WinGetTitle("[Class:IEFrame]"), 14) = "BBC iPlayer - " Then
   ConsoleWrite("A")
EndIf
WEnd


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi, IanN1990. Is the ">" in your WinGetTitle statement actually in your code, or did you just type that into the forum? Also, I don't see a closing ")" for that statement??


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks for the answer water :) and the code i posted is what i was using in the Autoit tool. If i ran it nothing would really happen but if i opened IE and a webpage loaded lots of "A"s would be written. (As my home-page is Iplayer i thought this ment sucess but then found it was doing it for every page".

Now using the stringleft it will only run on Iplayer related pages ;)

**Edit for Aipion so not to bump

Thanks for the idea but as waters code works and doesn't require any extra .au3 i went for that ;)

Edited by IanN1990

Share this post


Link to post
Share on other sites

I had a look at the source code of the pages and they seem to have a tag with a ID called "emp-container" which we can use at our advantage of finding if there is a iPlayer.

Try this:

#include <Inet.au3>
$s_URL = "http://www.bbc.co.uk/iplayer/episode/b01by7cs/Mark_Thomas_The_Manifesto_Series_4_Episode_2/"
$Has_iPlayer = StringRegExp(_INetGetSource($s_URL ),'emp-container',0)
MsgBox(0,"",$Has_iPlayer)

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