I had to log into a computer this last weekend for the reserves. I’m used to getting frequent updates for all the software installed on the machine (and believe me, the navy equips their machines with a staggering amount of software) but I was totally unprepared for the Outlook "update and configuration" tool which ran.
Here’s the screenshot, and notice the circled command being executed:
You see the "SendKeys" command? "SendKeys" is a command supported by Windows which performs the functional equivalent of a user typing at a keyboard. SendKeys("John was here.") would send the letters J, o, h etc… one at a time to whichever application has focus. If OneNote was in focus on the cursor was on a page, the letters would appear to be typed as the command was executed. If focus was in the search box, the letters would get typed there, and so on. If a login prompt pops up between the time the system sends the letter "J" and before "o," the "J: would go where I expected, but the "o" would get sent to the login popup dialog. This is the same technique our legacy automation system used, has this same problem with pop up alerts, and those focus problems alone are a good reason not to use that method.
This utility was literally using the Outlook UI to drive its configuration process. To "Customize Outlook," the app sent the keys to open Tools \ Options and then tabbed through the dialog to set the default reminder time to 15 minutes and made other settings like that. I was so stunned when I saw it running that I couldn’t even act and get a screenshot until it was on step 5 out of 13. Amazing – at one point of my Outlook testing career I tested and ensured that these settings could be deployed via reg keys and login scripts programmatically. To see a vendor use the UI to drive the process is simply mind bending to me.
Once I got over my initial shock, I naturally tried switching focus, opening new windows, sending random keystrokes from the keyboard to confuse the application. It would pause for a second or two, then pop Outlook to the top of the focus order and continue. I really wish I had been running a screen capture movie making utility. It took a few minutes to work through the UI and complete.
Oh, and for the Outlookers out there, this app moved my OST to the desktop. I have no idea why.
I don’t know if there are any new lessons to be learned here. I see this more of a reinforcement of "To a hammer, all problems look like nails" philosophy: whoever wrote this knew how to use the SendKeys command and implemented a solution using that functionality, without trying to see if there are vastly simpler ways to accomplish the task.
I’m amazed at what happens in the tech world.
Questions, comments, concerns and criticisms always welcome,