Friday Fun – Addictive Typing
Want to improve your typing? Try this typing game:
Very addicitve! I managed 943. I have NO idea how the top scorer achieved 3392!
Macro Recording and Automating Windows with Macro Scheduler – Tips & News
Want to improve your typing? Try this typing game:
Very addicitve! I managed 943. I have NO idea how the top scorer achieved 3392!
I helped someone today who was trying to record a web form that performed a file upload. File uploads are handled using an INPUT tag of type FILE. Unfortunately it turns out that these can’t be scripted for security reasons. Microsoft has prevented applications from setting the value property of these types of object. The solution was to send keystrokes to the Internet Explorer window to simulate a user entering the file name in the file box. You can view a demonstration of how to modify the WebRecorder code to handle this here.
Interesting video interview on Channel 9 with Bill Gates. Find out what he thinks about the Web and what the future holds for software. Microsoft have really become much more transparent lately. Channel 9 is a great way to get an insight into what goes on at Microsoft and meet some of the key people. Watch the interview.
I’ve just posted an example in response to a message on the forum where someone needed to extract data from finance.yahoo.com. The easiest way to create code to extract data from a page is to use WebRecorder‘s Tag Extractor. Unfortunately, finance.yahoo.com shows random adverts above the data and the HTML used to display the adverts is not always the same. What’s more the adverts are not always shown. This results in the HTML of the page being dynamic and the number of table elements can be different each time the page is loaded. Therefore the code that gets data from a specific table element may not always retrieve the correct data.
My proposed solution is to have the script search for the start of the data table. If you go to http://finance.yahoo.com/q/ae?s=UPS you will see that the first element in the table has the text “Earnings Est”. So the script uses the ExtractTag function in a loop. The loop starts with tag TD, index 30. If the content of that element is “Earnings Est” it stops, if not it loops back, incrementing the index. So on the next iteration it looks at TD31 and so on. When the value “Earnings Est” is found it jumps out of the loop and we now have the index of the first TD tag in the data table.
Now all we need to do to extract the data we want is to apply an offset to the located index. E.g. the value for Avg. Estimate, Current Qtr is in the 6th cell after the starting TD. So we add 6 to the index and use that with ExtractTag to get the data. And so on.
For the code and my explanation see the forum topic How do I pick numbers off a webpage?
I noticed an error that had crept into 1.66 when it was released which was preventing downloads from being recorded. This was basically because we’d gone and left some diagnostic code in. Our bad. Slapped wrists and all that. This has been fixed and 1.67 has now been released. Registered users can download from the registered download area. Or grab the evaluation version here.
We’ve also been working on a version of WebRecorder which creates Ruby scripts using the Watir library. More info on Watir WebRecorder can be found here.
There’s a new post on Microsoft’s Internet Explorer blog on using the keyboard to get around IE and some new keyboard shortcuts in IE7. Very useful for those times when you need to automate IE’s interface with Macro Scheduler:
http://blogs.msdn.com/ie/archive/2006/02/08/527702.aspx
See also: Keyboard Shortcuts
By Guy Tanzer
My name is Guy Tanzer, and I live in the Raleigh area in North Carolina, USA. Nearby is the Research Triangle Park, with the highest concentration of IT people and jobs in the eastern United States. I’ve been working with computers since 1977 and been in the business since 1984.
In early 1997, I started a job as a computer-support contractor to the United States Environmental Protection Agency in the RTP. One of the first tasks our team tackled after my hiring was migrating our lab of 350 users to Windows 95. To speed the process, my managers wanted to automate all the application software installs down to “one-touch” processes, which we could pick off a menu. The other team members got Lotus 1-2-3, Freelance, Word Perfect, etc., and Netscape 3.01 Gold was handed to me.
Now, Lotus and Word Perfect products came with documentation on how to write scripts to do automated installs. With Netscape, all we got was the .EXE file, with no docs on how to automate the install. A search of Netscape’s website turned nothing up. A call to them revealed that they did indeed have a solution, and we could buy it for only US$10,000…..
Well, that went a mite over the contracting company’s budget for solving this problem, if you get my drift. I needed a product of some sort that could wait for a window to open and be able to click on buttons, fill in fields, and so forth – just as if a “ghost in the machine” were watching and running the process for me.
I searched high and low for several weeks and tried perhaps eight different products, with poor results, before by chance I found and tried Marcus Tettmar’s MACRO SCHEDULER, which had only just been released. It did the job, and fit the bill, as elegantly and reliably as any product I’d ever used on a computer. Since we were one of his very first customers, Mr. Tettmar generously let the EPA lab use it on all their machines for the cost of a single license – only US$40 at the time. In return, I pushed the envelope on Macro Scheduler and kept in touch with Mr. Tettmar, giving him tips and ideas.
I used Macro Scheduler for at least a dozen more software installs, combining it with DOS batch files and compiled Quick BASIC programs to give it an incredible degree of flexibility. (I’ve since left behind Quick BASIC – it doesn’t handle advanced file handling systems – but Liberty BASIC is very similar to QB and another very worthy software investment. I find Visual BASIC to be clumsy and poorly designed for the types of scripts and programs I write in comparison to Macro Scheduler and Liberty BASIC.)
ANY software install or process which doesn’t give you “hooks” into the process, or a way to script an automatic run, can be attacked and solved with Macro Scheduler – quickly and easily. As I said, it’s “the ghost in the machine” in a positive way. It can watch for a window to open, and react to it – filling in fields, clicking buttons, whatever is needed. All the commands are simple, self-evident and in English, without the clumsy VBA scripting commands like:
GoAroundYourAssToGetToYourElbowJustToPushADamnButton
("Cincinatti",13,X,,"The Larch",,,,-.2E33,,42)
The one real problem I ever ran into was very specialized, yet Mr. Tettmar addressed it quickly and reliably. The problem was with Microsoft (surprise!) Powerpoint Viewer installation. Usually one keeps track of progress in a procedure by keeping track of the title bar in each open window; most software installs have unique title bars for each window as it opens. With the Powerpoint Viewer install, three or four consecutive windows had the same title bar and Microsoft, of course, offered no way to automate the install themselves. I asked Mr. Tettmar if there was a way to check to see what text appeared INSIDE a window, since each step in the Powerpoint Viewer install had unique text inside the uniformly-titled windows. Within a week, he came up with the FindWindowWithText command which worked perfectly in every application I used it on – Word Viewer, Excel Viewer, and I don’t even remember what else.
The benefits of all of this? I saved a fortune for the EPA and my contracting company. I saved boatloads of time working with a simple scripting language that is actually written in something extremely close to English, doesn’t have complex syntactical demands, and works like a charm. Mr. Tettmar has stayed with the product for nine years now; he isn’t a fly-by-night operator. He’s a good man, friendly, willing to help with obscure issues and find fixes for them. We’ve been email friends as long as I’ve been his customer. If I ever make it to “that side of the pond”, I’m buying the fish, chips and brew.
_________________
Thanks Guy. I’ll hold you to that offer!
If you have a Macro Scheduler Success Story I’d love to hear it. Drop us a line.
I’ve resurrected an old thread in the forums called “Tell us how Macro Scheduler helps you, what you use it for”. It’s now a sticky so that it won’t get buried away again. We’re always interested to hear how Macro Scheduler is being used and how it benefits people. It’s helpful for other people to read examples of how Macro Scheduler is used in the real world and how it benefits businesses. So please dive in and write a few lines to explain what Macro Scheduler does for you.
Really nice article over at StickyMinds by Lee Copeland: All I Ever Need to Know about Testing I Learned in Kindergarten.
I spoke too soon re WebRecorder and IE7. Microsoft have improved the way SELECT fields (drop down boxes) work in IE7. For previous versions of IE, WebRecorder has to use a convoluted process to detect clicks on SELECT fields and find the corresponding drop down object (Internet Explorer_TridentCmboBx). In IE7 things are much simpler and they are exposed just like other HTML elements. So we’ve updated WebRecorder today to handle this. WebRecorder 1.65 now works with IE6 and IE7.
Registered users can download the update from the registered downloads area. Evaluation downloads are here.