Jump to content
Macro Express Forums

How to recognize a specific web page


rberq
 Share

Recommended Posts

I am working with a Web-based application that can display many different screens as the users maneuver through their daily work. The URL never changes. The window title never changes. But when a particular screen displays I need MacroExpress to do stuff. I can schedule a macro to run every second, or I can loop in a macro -- but what do I check for?

 

One suggestion I found on this forum is to use CTRL-a to "select" all screen fields, CTRL-c to get them to the clipboard, then analyze the clipboard data for the known pattern of data. That would work, but would momentarily turn lots of screen fields blue every second, no matter what function the user was engaged in, and the flashing would seriously disrupt their sanity.

 

Another forum suggestion is to view source of the page, store it in a file, then examine the content. That would also work except that the source is popped up in a Notepad window which also disrupts the user.

 

The only other idea I have come up with is to get pixel colors at various known points on the screen and check for an expected pattern of colors. I haven't tried it yet, but it seems potentially unreliable or subject to false positives.

 

Clever tricks, anyone?

Link to comment
Share on other sites

I recognize it by the white data entry fields, the gray labels for those fields, a large unused white space at the bottom, and the various darker gray labeled buttons. None of these seems to be a control that can be captured. That's why I'm thinking of color patterns -- other screens wouldn't have fields and buttons at the same places, probably. But I don't know much about Web pages and their constructions -- I was hoping there was some behind-the-scenes data that ME could capture to provide the identification.

Link to comment
Share on other sites

It sounds like checking pixel colours is the way to go. It's very quick for a limited number of pixels (I can easily check a 40x50 rectangle of pixels without noticing any impact on performance). But remember to build in some safety features, e.g. do your pixel checking within a repeat loop a set number of times with a delay between repeats; once the repeat has exited (if the pixels are found) or ended (if they're not found) check to see whether the search was successful.

Link to comment
Share on other sites

Yes, I played at it today and also found it to be pretty fast. Now I have to lay some restrictions on the users. 16-bit color produces pixel values a little different from 32-bit, but it seems to work OK if I check for a small range of values. But people with exotic color schemes are going to have to come back to Windows Standard. I suppose I could make a macro to examine the screen in question, once at startup, and custom-tailor the color-checker values for whatever scheme the user has chosen. Now it's got me wondering, where in Windows the color gets translated from whatever the application sends, to what is displayed on the screen, and how would I do a reverse translation? Way too much work for what should be a simple process....

Link to comment
Share on other sites

Now it's got me wondering, where in Windows the color gets translated from whatever the application sends, to what is displayed on the screen, and how would I do a reverse translation? Way too much work for what should be a simple process....

It's worse than you might imagine! Change your video adapter, or even simply update your video adapter's driver, and you may well find your pixel values have changed! In the days before ME had a "Move mouse to tray icon" command, I even found that the icon sizes and locations would change with a new version of the video driver.

Link to comment
Share on other sites

It's worse than you might imagine! Change your video adapter, or even simply update your video adapter's driver, and you may well find your pixel values have changed! In the days before ME had a "Move mouse to tray icon" command, I even found that the icon sizes and locations would change with a new version of the video driver.

 

Now that's scary. I have found by forcing the window to top left and changing size to a standard dimension less than or equal to the Windows setting, my macro works OK on the two PCs I have tested on. From what you're saying, I had best test it on a variety of machines before I can feel confident.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...