Jump to content
Macro Express Forums

Web-based applications - acting directly on controls

Recommended Posts

I have scripted dozens of MEP macros that allow me to control a complex web-based application by keyboard and voice. All of my scripts work by manipulating the User Interface: click here, tab there, search for a pixel colour, monitor the shape of the mouse cursor, etc. The macros are surprisingly reliable, but as a whole, I find the system ungainly. Some of these macros perform thousands of steps to identify and navigate to a hypertext link; others only work if the object I am trying to act upon is visible. I am tired of these limitations!


I want to understand how to approach these tasks programmatically, but I cannot quite figure it out. How can I reliably move focus to a certain edit field; select an item from a drop down list; click on a "Save" or "Close" button; check or uncheck a particular checkbox; and activate a link... without dozens (or thousands) of lines of code that may or may not work if I switch screen resolutions.


"External Script" commands look promising, but I cannot figure out how to use them to perform even simple tasks. I would appreciate if contributors to this forum would post code samples that illustrate how they use "External Script" commands to check a checkbox, focus a particular field, etc. in applications that run in a web browser.


I have been on this forum for years and have greatly increased my ability to work with MEP. My sense is that many experienced MEP scripters are "stuck" exactly where I am. I am ready to move on to the next level, but need a little help!

Link to comment
Share on other sites

I write a lot of web based macros and feel the same way. I've looked more into it and although there are other macro applications that are designed specifically for web browsers they don't do much outside of web browsers. IE they can't take data they got from a web page and go to another app and transfer it there. In many cases I've gone over to writing proper compiled applications which run amazingly fast and with none of the errors or frustrations like timing. I just finished a scraper that will download, extract, and process the data from a website at the rate of 3-5 pages per second. But you need to learn a proper programming language to do this.


One thing I did experiment with before going over to proper programming was to use the Internet Explorer API (Application Programming Interface) via external scripts command and VBScripts. It actually worked really nice. You create an object, visible or not, and things like data fields are properties of that object and actions like clicking a "Submit Button" are methods (actions). EG you create an IE browser window, set the field properties to their values and have it execute the submit. It happens so fast that to the user the the browser seems to appear initially already propagated and disappears instantly if you close it afterwards. I actually had to add delays just to make sure it was working as I was incredulous. I didn't spend much time with this however because for things like scrapers or other data push/pull where no user is needed it made more sense to go fully to a program. Also the user input on VBScript is extremely limited and I wanted a proper program form for the user to command and monitor the scripts from. But this API can be very handy for existing macros or macros that also interact with other programs and user.

Link to comment
Share on other sites

Hi Alan,


I don't do much of it but from when I have tried that sort of web-based macro I can appreciate your frustration.


I think that in similar circumstances I would seriously consider using AutoHotkey (AHK) to supplement ME Pro.


Motivated by other limitations of MEP, I installed it and have used it in several macros. And in some cases, instead of using ME Pro. (Except perhaps for listing its use in one the appropriate MEP menu, in case I forget the AHK hotkey!)


But I have not yet invested the substantial time necessary to learn how to write any but the most trivial scripts myself. Frankly, as an end user with no recent programming skills and no professional motivation, I suspect I never will.


However, there's an excellent, high traffic forum at http://www.autohotkey.com/forum/viewforum.php?f=1 and I've had generous practical assistance there several times. With some effort, and working to some extent 'by rote', I've been able to adapt what I was given. It's second best (I far prefer to fully understand what I'm doing!) but it got my stuff working.


There's also an extensive library of ready-written scripts you can use.


If interested, as a start you might want to take a look at the 'Tutorial and Overview' at http://www.autohotkey.com/docs/Tutorial.htm



Terry, East Grinstead, UK

Link to comment
Share on other sites

I personally recommend using AutoIt (which is one of the script languages supported by MEP)


because it has the most comprehensive set of user-developed functions (50) for working with Internet Explorer I have ever seen.

Mind you, the amount of work involved to understand and learn the supplied functionality would be prodigious, although getting it to work with MEP would be quite easy.

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.

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.

  • Create New...