Create Automation Scripts For Windows With AutoIt

http://videohive.net/?ref=gimmegfx



autoit-thumbThere are many automation tools for Windows. You can utilize built-in Task Scheduler to schedule tasks, or use Folder Actions to put together events for folders. If those are not enough for you and and you prefer to make use of a more complicated and powerful automation tool, AutoIt is a useful tool for you personally to create automation scripts.

AutoIt is a scripting language that's more powerful than batch scripting which enable it to automate almost any kind of task in Windows.


Getting Started


AutoIt is not a complex scripting language. If you have some programming knowledge, it is possible to pick up AutoIt quickly. It will take a while in your case to be aware of the syntax, but once you receive it going, it will be possible to make use of it to automate repetitive tasks and create other programs that work in Windows.

First of, you simply must download the AutoIt installer and install it in Windows. The default installation of AutoIt comes with a lite version of SciTE editor, that can be used for creating basic scripts. If you require heightened functionality, you may have to download and install the complete SciTE editor.

AutoIt documentation can be available online. It includes (almost) everything you should know about AutoIt language.

Below, we'll show you some situations of what AutoIt are capable of doing:


Automating the launching and closing of applications


To launch a credit card applicatoin, utilize Run command in AutoIt:

Run( "program.exe", "c:\program path")

autoit_run

You can also run the application form with different user credentials with all the RunAs command. If you want to wait for an particular application to shut before launching the next one, you may use RunWait command.

To close an application, you can create use of the ProcessClose command.

For example, to close Firefox:

local $pid = ProcessExists ("firefox.exe") if $pid then ProcessClose ($pid)


Automating program installations


The beauty and power of AutoIt is you can automate virtually anything in Windows, including the installing application. If you are a network administrator and would like to automatically install programs silently without user intervention, AutoIt are capable of doing this very easily.

Basically, you will have to run the setup installer first by using the Run function:

Run ("setup.exe")

You may also give full path in the program if it's not in the current directory.

Run ("C:\path\setup.exe")

Then we need to wait until the interface appears on the screen. We can use WinWaitActive function for this specific purpose.

WinWaitActive ("Window title", "text")

autoit_winwaitactive

When of the question becomes active, we'll be while using shortcut secrets of go through the setup process. Most from the installers permit you to use keyboard shortcuts to proceed using the installation process. Usually laptop keyboards shortcut is denoted by an underline letter, so you will have to press “Alt” and the underlined letter for doing things.

In AutoIt, you can utilize Send function for processing the keyboard shortcut.

Send ("!a")

And when you only must press the Enter key, simply send Enter:

Send ("Enter")

And once the installation is complete, you are able to close the window by using WinClose function.

For example, to automate the installation of Microsoft Office, the script will look like this:

;Run the Office 2010 installer Run ("setup.exe") ;Wait for the setup window to be active WinWaitActive ("Microsoft Office Professional Plus 2010", "setup") ;Accept the license agreement Send (!a) ;Proceed to the following screen Send (!c) ;Install Office with default options WinWaitActive ("Microsoft Office Professional Plus 2010", "Choose the installation you want") Send (!i) ;Close the setup when office is installed WinWaitActive ("Microsoft Office Professional Plus 2010", "Setup Complete") Send (!c)

Since the installer will automatically close after installation, we don’t should run the WinClose function.


Creating Macros


What makes AutoIt better yet is the Macro recorder which can be used for lengthy and tedious sequences of keystrokes. The Macro recorder comes in the full version of SciTE editor.

autoit_macro_recorder

To access the Macro recorder, open SciTE editor and check out “Tools -> AU3Recorder” or simply just press “Alt + F6″ shortcut key. The macro recorder will record your entire keystrokes after which simulate those keystrokes when the script is run. The only limitation from the macro recorder is that we don’t get WinWaitActive function inserted automatically between each keystroke. It is important to include WinWaitActive function otherwise the script will complete its execution could the first setup screen appears.

autoit_recorder_1


Conclusion


While there are several other ways to automate programs and tasks in Windows, AutoIt is much better and can perform the most tedious tasks simply.

Do you utilize automation within your daily work routine or are comfortable with doing things manually?

Title Post: Create Automation Scripts For Windows With AutoIt
Rating: 100% based on 99998 ratings. 5 user reviews.
Author: SharedTutor

Thank you for visiting sharedtutor.com, If there is criticism and suggestions please leave a comment


thumbnail
About The Author

Someone who always wanted to know about the beauty of the world :)

0 comments