Quantcast
Channel: Marcus' Macro Scheduler Blog
Viewing all articles
Browse latest Browse all 184

Detect Which Web Page IE Is On – Keep It Simple

$
0
0

Today we had two different support requests asking how to have a Macro Scheduler macro determine which page IE is on.

One person was asking about using Image Recognition for that. You could also use the IE functions to examine the HTML or look for the existence of a specific HTML element.

You could do one of those, sure, but I think that’s over complicating things.

My motto is “keep things simple”.

IE’s Window Title adopts the page title of the web page it is displaying. IE also shows the URL in the address bar. So why not just look at one of those. Like this:

//Two simple methods to see which page IE is at.

//Method One - Just look at the window title
IfWindowOpen>Bing - Internet Explorer
  //Bing is open - do this
Else
  IfWindowOpen>Google - Internet Explorer
     //Google is open - do that
  Endif
Endif

//Method Two - Look at the Actual URL in the URL bar - I used the Wizard to get this code and then altered the window title to make it a substring match
UIGetValue>- Internet Explorer*,{"Address"},curVals,Positions,nHeight
Position>google.co.uk,curVals,1,pGoogle
If>pGoogle>0
  //must be at google
Else
  //must be somewhere else
  Position>bing.com,curVals,1,pBing
  If>pBing>0
    //must be at bing
  Endif
Endif

Related posts:

  1. Youtube Page Facelift
  2. Automating Google
  3. Making your macros intelligent with If, Else, and Endif

Viewing all articles
Browse latest Browse all 184

Trending Articles