Jump to content

[Solved] Detect Webpage


IanN1990
 Share

Recommended Posts

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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
Link to comment
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)
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...