AutoIt, Macro Programming, and Why You Should Learn

If I were the head of a Department of Education, I would make AutoIt a mandatory tool learned in every high school. In terms of computer literacy, I’d rank it the most useful tool after Microsoft Office. In high school, I taught myself how to program using AutoIt and then at Rice University I taught a course, MURT 102, on how to use it.

The vision of the AutoIt authors is to make a simple scripting language designed for automating general computer tasks. Introduced in 1998, AutoIt simplified the complicated code and advanced programming skills needed by a user to configuring thousands of PCs to perform automated tasks for a variety of advance applications. Despite the sophisticated features, the BASIC-like programming syntax makes it a wonderful tool for both beginners and advanced programmers.

AutoIt programmers can simulate key presses, mouse movements, and window commands to automate daily tasks. These scripts have access to some of the low-level aspects of hardware such as the CD ejection tray or automated shutdown of the computer. In addition to automation scripting, AutoIt provides the ability to connect to common applications, such as Excel and FireFox, in addition to more advanced tools like SQL. AutoIt takes advantage of the Window’s operating system internal library commands (DLL) to perform these tasks. As an additional feature, programmed scripts can be compiled into a stand-alone executable for computers without an AutoIt interpreter, permitting programs to be instantly used on any computer and run by clicking a custom icon (very useful if you want to create a one-click button to empower your grandmother when she needs to compose a blank email to her best friend). Beyond simple programming syntax, AutoIt has excellent documentation with numerous examples. This documentation is complemented by the helped of the AutoIt community, which is very vibrant, encompassing tens of thousands of users.  By learning the ability to create automation scripts, individuals can be more effective with their time when performing tasks that are manual and tedious.

After learning about AutoIt, I added additional tools to my normal computer routines, which has enabled me to perform certain manual tasks probably 100x faster.  I’ve used it to automate program commands during my internships. I used this language to examine and create logic from text appearing in shipping software, by pixel searching for the text and asking for user-input at a critical decision moment, and then subsequently sending a string of keyboard inputs. I used the language to search 10,000 contacts from different Excel files and merge them together, to a reduced list of 3,000. In addition, this involved Regular Expressions to check for abbreviations and misspellings. I wrote a program that would constantly check the Rice University website for when a student dropped a course and text me so that I could register to enroll. I think these different experiences have provided me with the insight into the important features about AutoIt and why it has gained such as strong and supportive community. Although I own a Mac, I’ve programmed extensively in AutoIt, because the performance I gain from scripting is often too convenient. I’ll continue to buy future versions of the Windows operating system, because AutoIt is a killer application. You won’t know the full power of your PC unless you’ve used AutoIt.

Below I’ve attached the Power Point presentations from my course MURT 102. Although a few computer science students enrolled in my course, my goal was to target students of non-technical majors in a light 1-credit class to teach them programming concepts that would continue to be applicable in a student’s future because the tools learned complemented practical, everyday computer situations. The features I taught students was how one could control mouse movements, open applications, download files, send emails, and manipulate Excel. I hope my course material will provide students with instant gratification and inspire them to dabble in some of the lower-level languages.

Topics Learned:

  1. Week1 – Setup / SciTE Editor – Keyboard Commands: Students will learn to manipulate Excel from the front-end by simulating keyboard commands using the SciTE Editor.
  2. Week2 – For Loops – Mouse Movements: Students will learn to combine mouse movements to read text from the screen and display it in a Msgbox. Students will learn about for-loops and how this enables one to move the mouse in patterns. In addition, students will become familiar with the AutoIT Information Window.
  3. Week3 – Functions and HotKeys: Students will learn how keyboard keys can be tied to commands in a function. In addition, students will learn how to write custom functions used by their programs.
  4. Week4 – If Statements – Opening Applications and Window Manipulation: Students will learn how to request from the operating system different applications and instances of application windows. They will learn to use logic to check if the correct windows were discovered.
  5. Week5 – Debugging, Console Writing, PixelSearching: Due to the complexity of the code, students will learn how to debug their programs using the SciTE editor, Msgbox, and Tabtoolbars. In addition, students will learn a fast way of searching for text that does not involve mouse movements by pixel searching. They will use pixel searching to play an online game.
  6. Week6 – Arrays -String Manipulation: Students will learn how to process text content with a combination of string functions.
  7. Week7 – Using the Forum – Regular Expressions – UDFs and Downloading Web Content: Students will be introduced to the AutoIt community forum and the more advanced topic of string manipulation through Regular Expressions. Students will be introduced to User Defined Functions and the UDF needed for downloading web content.

A list of relevant links for learning more about AutoIt:

– Richard Latimer (LinkedIn)