Overview
This is a very useful scripting language that is free for all use. I have been using it for many purposes, primarily for scripting deployments of software. It has the unusual benefit of being able to script the Windows GUI. It is well documented and quite easy to use. You can find forums and more at
http://www.autoitscript.com/autoit3/
Help/Support
Their forums are the primary contact for help. You will need to register an account to post, but you can freely read the forums. Registering an account is free. Perhaps there should be a LEPP account?
The
general help forum provides pretty good assistance in getting scripts working.
The
Example Scripts forum provides lots of finished and work in progress scripts, functions, and libraries. Check out UDFs(User Defined Functions) in the Scite help file, and look for others in this forum.
Scite Editor
I recommend using the Scite package they provide, the Scite Editor is great. Also using
Au3Info.exe to read out GUI control codes for scripting is very helpful. Finally it also includes the
entire help file for Language reference.
Here you see a typical script in the Scite Editor:
Looking here you can see underlined the general way to run dos commands, here with wuauclt and arguments. This is the "wrapper" style, though this script also writes entries to the registry.
Compiling in Scite
Once you are done, choose Tools -> Compile, uncheck allow decompilation. This will compile the script to an exe in the same directory as the source code.
Compiling Scripts
You can compile a saved script by right clicking on it and choosing compile. This will bring up the same dialog as compiling in Scite, and has the added benefit of not creating an ini file in the directory of the source script.
Current Script Source Code
Script source for all
AutoIT scripts is available at \\PC140\E$\Test
AutoIT scripts\. Some scripts are commented, others are not. In general the name or discription comment will clearly indicate what the script is trying to do.
Example Script
Here is a script example with several interesting features. It is our route setup for Hamachi, it has network file reads, UDFs, Functions and more. This probably is about as complex a script as is generally necessary. The MsgBox function includes the ability to change the message box button lables, where the built in function does not.
Note that I have edited out the passwords. The RunAsSet comments are just holdovers, they are not necessary for the script, but are an example of how that would work as well.
Registry operations in AutoIT
You may succeed in running a batch file to use regedit to merge in a registry file. If this fails, and regedit run directly also fails you can edit the registry directly from an
AutoIT script. A method to export the registry of a test machine to
AutoIT script form exists in \\PC140\E$\Test
AutoIT scripts\Useful Scripts.
Running DOS files
RunWait(@ComSpec & " /c " & '"batch file or dos command"',"",@SW_HIDE)
RunWait waits for the command to exit prior to continuing. You can use Run to continue immediately.
@SW_HIDE is a flag for all run commands to hide the dos window or really any window that is created by the run command. This works for DOS, I am not sure for other windows, haven't really tried.
--
JamesPulver - 12 Mar 2007