Friday, May 9, 2008

AutoItv3 versus AutoHotKey

When trying to enter the wonderful (and with a slightly bad reputation) world of Windows scripting and macro-building, one is bound to come across two programming languages in particular: AutoIt v3 and AutoHotKey. At first glance they seem quite similar and this is only natural: AutoHotKey is built on a version of AutoIt v2, they both try to stand out with their capability of simulating key strokes and mouse clicks, ability to automate certain tasks and GUI capabilities. Once however one starts to delve deeper into the inner workings of these programming languages certain differences become apparent.

The first difference you should notice is the program syntax. While AutoIt is quite similar to C-like languages in format (such as C++ and PHP), AutoHotKey is quite unique, unfortunately in a negative way.

A good example on this is calling functions inside the program. While in C++, PHP and AutoItv3 the parameters of the function would be contained between two parentheses, separated by commas (such as function_name ( parameter1, parameter2... ); ), in AutoHotKey the parameters are only separated by commas (function_name, parameter1, parameter2....). Although not a huge disadvantage, this does not only make switching to and from AutoHotKey and other languages more difficult but it also discourages new users.

Another advantage AutoItv3 currently has over AutoHotKey is its larger fan-base, which translates into more user-made function libraries that greatly increase the ease of building an AutoIt program. These libraries range from better GUI control to file management and even functions to manipulate Internet Explorer.

One of the things that impressed me most about AutoHotKey is its HotString feature. To illustrate this we'll use the following example: you're chatting online and for some reason want to avoid using certain acronyms (such as "lol", "brb" etc). This is easily done using the HotString feature of AutoHotKey:

::brb::be right back

The code above will create a new HotString (sort of like a HotKey) that, when activated, will replace "brb" with "be right back". Back to our online conversation, let's say that by mistake you type "brb" and hit "Enter". No problem, the program will have already converted "brb" to "be right back". This HotString feature can have a wide variety of uses, as illustrated on the AutoHotKey website. Also, while most actions are of about the same difficulty in implementing into AutoIt and AutoHotKey, the HotString feature would prove very problematic and time consuming to implement into AutoIt.

Overall i believe that, faced with the choice of learning either AutoIt and AutoHotKey, you would probably be better off with going with AutoIt. The user-made libraries really help at times when designing your own solutions would take a lot of time and patience. Personally I've been using AutoIt for about one year and a half, maybe two. Since first discovering it back in 2006 I've always used it, along with PHP, as the main programming language in which i work because of its rich libraries of functions and similarity to other programming languages i used in the past.

Later edit: After working with AutoHotKey further I have to say that, although I still find the syntax annoying and the incorporated libraries of functions aren't as evolved as those of AutoIt, when it comes to handling hot-keys and similar types of input (such as the HotString feature), AutoHotKey shines.

While I still think that, overall, AutoIt v3 is superior, having a look over what AutoHotKey has to offer is well worth the time and could be a life-saver in the future.

2 comments:

Anonymous said...

If you intend to create full-featured Windows applications, I would suggest AutoIT. But, if your intention is to create several small tasks activated by hotkeys and/or shortcuts, I would suggest AutoHotkey. Read more on my blog.

Gkanks said...

If you intend to build full featured windows apps you should use a programing language not a scripting language. These two apps are great for automating routine tasks but use Java or something.Net for a real application.