Autoit description of functions. An employee on a leash: Review of programs for automating routine operations. What is AutoIt3 for?

ALEXEY BARABANOV

Automation of MS Windows, or AutoIt as an Enikey's dream

Part 1

If the copier does not work, call the system administrator.

This is an electronic device, isn't it?

Since the advent of computers, humanity has been divided into users and “computer geeks.” They stood on opposite sides of the electronic computer, sometimes confused as to the exact class or group they belonged to. But gradually everything and everyone fell into place. The number of users increased, and the number of “computer scientists” was only refined. While there were few computers, and they were large engineering structures, serviced by entire teams of “computer specialists”, which included a fair number of mechanics and electricians, they tried to make the number of users per computer as large as possible. The general ratio of users to “computer scientists” was of little interest to anyone, since computers were the main resource. But with the advent personal computers, when the proportion of their number to the number of users irrevocably moved into the category of integers, it became very expensive to have a team to service each computer. It was from this moment, from the moment of the creation of personal computers, that developers of both equipment and software began to think about reducing the cost of servicing their products. It was then that abstract “computer scientists” began to turn into system administrators specializing in maintenance computer systems. At the same time, special software products, intended specifically for system administrators or focused primarily on solving maintenance problems.

For example, IBM 360 users working in a DOS environment had to somehow know and be able to use the JCL job control language, and if they worked in console mode, then the language for controlling the operation of the entire system. But the same IBM PS/2 users working in the OS/2 environment could no longer know anything about the system settings and be content only with what the graphical interface provides them.

Thus, the issue of distinguishing users from system administrators has come down to the difference in the interfaces they use. User of a computer built into mobile phone, controls the device using a graphical interface and buttons on the body of the device, and the technician servicing the same phone uses console commands or graphical interface programs special computer, to which the mentioned phone is connected via a JTAG technology connector. In other words, the interface must correspond to the tasks being solved. But for personal computers, the interface was truly fateful. After all, their most important difference from computers used collectively was the exclusive provision of all resources to one user. This could not but affect the way the interface problem was solved. Many of the first personal computers were sold as TV set-top boxes, such as the Sinclair. That is, without a TV it was not yet a computer, but after connecting it, the computer could already be used. This showed the importance of the interface.

The commercial success of the PC depended to a very large extent on how the interface issue was resolved, and how easily this interface could be used by untrained consumers. If the first PCs had the same text interface as mainframes (for the record, JCL was called “bird language” by many for its super-intricacy), then, most likely, as soon as they appeared, these devices would have sunk into oblivion. But this did not happen precisely thanks to the accessible and attractive graphical interface. At first, the main thing was in the screen itself, that is, in the television tube. Probably, people were attracted by the fact that it could be used to view not only news and movies. But then the Xerox company successfully experimented with training intelligent upright mammals to use a mouse with one button. This was truly a revolutionary event. And although the “mouse” has since managed to increase the number of buttons, the proposed method of interacting with a PC by pressing the mouse buttons, or “clicks,” has become firmly established among computer users. And in the same way, he definitely forced system administrators to take a negative position towards this process - “mouse clicking”.

Interfaces

If the system administrator tells you on the phone,

what buttons need to be pressed, read the newspaper.

Actually, I don't want you to do anything.

Why did the “mice” not suit the system administrators so much? It was not so much about the mouse manipulators, but about the features of the graphical interface used at that time. Since the main indicator of the level of system administration has become the number of computers serviced by one employee, means of ensuring automation of system operations, OS installation, configuration and management have become critically important. And the solution to this issue was closely related to the provision of all these same works through remote access channels. Naturally, for platforms with a text interface, both the first and second were easy to solve. There were simple scripting languages ​​that made it possible to very quickly program any OS control operation, and the means of providing remote access in text mode were provided at a fairly weak technological level of communications. For example, this is how administration issues were resolved in the UNIX family of operating systems. But in operating systems oriented towards working in a graphical environment, everything was not so simple. First, the graphical interface is, from a semantic point of view, entirely determined by the application program. That is, the reaction to activating the “OK” button in the graphical menu depends on the phase of the dialogue and on the purpose of the program servicing it. Secondly, enabling remote work in a graphical environment required much more bandwidth from communication channels than working in a text interface. All this led to the fact that automation of graphic settings practically did not develop. Well, perhaps by the OS developer itself, in this case Microsoft, by increasing the complexity of nested menus. And for system administrators to work in the environment Microsoft Windows turned into an endless training of the wrist muscles, since their capabilities were practically no different from those that were provided to ordinary users, only the headings and content of the drop-down windows changed. This has played a positive role - a mouse-type manipulator has recently transformed from a primitive “gurney” with impellers and a rubberized ball into a high-tech device based on an optical (laser) scanner and equipped with a radio channel for communication with a computer. But it is clear that even if the mouse is converted into an implant with a computer interface, this will still not allow one system administrator to simultaneously service a larger number of computers, as required by the modern IT industry, subject to strict TCO frameworks: http://www .telecominfo.ru/?t=2012, table 2. And the growth in the number of simultaneously serviced user computers (Full Time Equivalent - FTE) was constrained by the underdevelopment of automation tools for system work in OSs built on the basis of graphical interfaces.

This is not to say that everything was limited only by technological problems. The fact is that on the MS Windows platform, which for a long time had no alternative for personal computers, mainly proprietary software products are used. And the solution to the problem of their mass installation in progress contrary to the requirements to comply with the mandatory registration (legalization, activation) procedure for each copy of the program. Typically, the procedure for registering a copy is surrounded by special protective protocol and not always technical steps, for example, you need to agree to the license, enter serial number from a box or CD, insert a key disk into the drive tray, activate via the Internet and much more that comes into the head of a developer concerned about making a profit. Even the MS Windows OS itself in its boxed embodiment is not intended to create automated systems installations based on it. What is the point of automatically reproducing one copy if, according to the marketing plan, all sold copies of this system require an original registration procedure for each of them. Of course, loopholes and other reservations were left. Well, the “founding fathers” of this software “pyramid” couldn’t simply reduce the entire institution of system administrators to the position of “Enikey people.” Therefore, there were so-called “corporate” versions that allowed serial installation, like copying the same installation procedure onto many computers. True, in retaliation, other restrictions were introduced there, for example, on the installation of updates. But not every software manufacturer could afford even such surrogate freedom to automate routine operations of installing their own products. Therefore, another problem with automating work in a GUI environment is that many software products are not intended for automatic installation and configuration due to design, since they required “human” actions during the installation process.

Animation instead of automation

If you see the message “Are you sure?”

Click “Yes” as quickly as possible!

Damn if you weren't sure

you wouldn't do that, would you?

And now all these problems have been solved. A tool for automating operations in a graphical window environment appeared, which simulated the work of a human operator, called AutoIt and was originally intended to automate program installation operations. Currently you can use version 2.64, downloaded from http://www.hiddensoft.com/AutoIt, and version 3.1.0, available at: http://www.autoitscript.com/autoit3/index.php. These programs are distributed under open licenses. Version 2.64, written by Jonathan Bennet, can be used without restrictions in non-commercial projects, but in commercial projects it is necessary to include a link to the developer's website along with the product. Version 3.1.0, authored by the aforementioned Jonathan Bennett together with the AutoIt Team, is already under the GNU GPL, which indicates the maturity of the approach and the impossibility of further removing this program from free circulation by transferring it under some closed license. For both versions, in addition to the attached Help file in English, there is also a Russian version of the documentation in chm format, prepared by Valery Ivanov.

If we consider this program separately from the context of its intended application, then it is just a means of intercepting the analysis of the state of the window interface and emulating the necessary messages, supposedly on behalf of the operator. It almost looks like a demonstration animation. But from the point of view of a language machine, for example, Unix bash, interpreting a certain script, all actions look just as multiplicative. Only this is not noticeable to anyone if it happens not on the screen, but in a text console. And especially since text interpreters have the ability to hide and redirect processed character streams. But we can also name a complete text analogy from the *nix world to the program discussed here. This is a well-known expect tool. It allows you to replace communication with text terminals for some application programs and thereby automate the operator’s work by emulating the process of his work. This is usually used to automate work with interactive environments, for example with ftp. Notably, both expect and AutoIt include a tool that facilitates the creation of scripts by recording captured real interface data. Of course, in AutoIt this is still a very immature manual tool that shows the characteristics of the selected GUI element in a modal window.

From a technology point of view, AutoIt just uses the capabilities inherent in the GUI API. The same result can be achieved using Visual Basic or even C++. But that’s the difference: using AutoIt allows you to avoid programming in “heavy” languages. Because the system administrator is not a programmer, and he does not need to write programs, but only solve standard automation problems that arise in the course of his work.

So how does it work? Such a tool must be able to enter all the necessary data into the environment it controls, analyze the response, and, to the extent of standard language capabilities, organize the interactive execution of the described process. All! If the interface is textual, which is true for expect, then such a system must input string sequences, receive and analyze response strings, and, depending on the result and due to the capabilities of its syntax, organize some algorithmic process. If the interface is graphical, then GUI specifics are added to the above. The input data includes control of the behavior of windows (detection, activation, minimization, closing, etc.), bookmarks and other window interface elements, mouse movement and button clicks. In the same way, events for creation, activation and other operations with windows are added to the received data. Well, the rest is entirely determined by the design of the built-in language. Version 2.* uses a language with a comma-delimited assembly-like syntax and primitive control statements based on conditional branches. In the 3rd version, it is already an almost full-fledged programming language with familiar control structures, including functions, and as a result, goto is removed from use in this release. Both versions allow you to both interpret operators written in a separate script file and create an executable version based on runtime components. But version 3.* is one and a half times heavier. Therefore, executable files based on version 2 have a size of 40 KB, and version 3.* - from 116 KB. Probably due to the greater number of built-in functions. In addition to what has already been listed, version 3.* has built-in timeouts in wait statements, which allows you to solve the problems of “hanging” unstable applications, but in the practice of automating standard actions you can successfully do without this. In other words, solutions built on version 2.* are still relevant for 90% of problems solved using AutoIt, but release 3.* allows you to create full-fledged applications, if necessary. There are even examples of gaming programs in Internet resources dedicated to AutoIt.

Software installation

If you are taking evening computer courses,

be sure to test your knowledge on your

and all the neighbors' computers.

We love working until 2:30 am fixing it.

I think the theory is enough. Next, we will consider various examples of real use of the proposed technology. The goal here is not to write large and sophisticated programs. The main thing is that these are workable and practical scripts and programs. Some of them will be discussed in the text, others are simply indicated in the links and are intended for independent study. Many of them will be used in the final comprehensive example of creating a disk for automatic installation of MS Windows. Starting from the simplest, the proposed programs will gradually become more complex, which does not prevent, after reading the entire article, returning to the beginning and reworking the considered programs using the entire arsenal of AutoIt.

As a first practical example, let's look at automating the installation of AutoIt itself. Since we have two working releases at once, 2nd and 3rd, we will solve the problem of automatically installing AutoIt version 3 using the script for version 2. To do this, install AutoIt version 2 on the system and create it using text editor Notepad file setup_autoit3.aut. The "aut" extension is standard for AutoIt2 scripts. Let's write the following sequence of operators:

SetTitleMatchMode, 2

DetectHiddenText, on

// remove all windows from the screen

WinMinimizeAll

// wait a second

Sleep, 1000

Run, autoit-v3-setup.exe

// completion

Exit

This very short program will become the basis of the script being developed. All statements are annotated and the contents are completely clear. But before we launch it, let’s download “AutoIt Reveal Mode” - a special tool for viewing information hidden in structures associated with windows in MS Windows. Then we run the script and wait for completion. After the completion message appears, close it by clicking on the “OK” button and expand all windows again. It should look as shown in the figure.

Please note here that the AutiIt v2.64 window displays the entire list of text lines from the active window, starting with its title. It is these lines that the installer will further “catch” in our script, and since the Next button is already highlighted as active, as soon as the script waits for the window called “AutoIt v3.1.0. Setup", you can send Enter to this window, which will lead to pressing the active button, that is, going to the next installer screen. Here is the text of the next, more complex development phase:

// set the mode for detecting hidden text in windows

SetTitleMatchMode, 2

DetectHiddenText, on

// remove all windows from the screen

WinMinimizeAll

// wait a second

Sleep, 1000

// start the installation from the same directory

Run, autoit-v3-setup.exe

Send, (ENTER)

// display a window with a message

MsgBox, 0, AutoIt, Setup done

// completion

Exit

To check, cancel the installation and run the script again.

After stopping, let's finish our script again, maximize all windows and analyze the result shown in the figure.

Here, similar to the first launch, we will follow the areas marked in red. The task is to “catch” a new window and activate the desired action. But the window has the same name as the previous one! Then we look in the interceptor window to see what other string values ​​are available to us. Find the line “License Agreement”. This line best reflects the specific meaning of the resulting window. And since here again the desired action is immediately set by default, then after detecting this window you need to send Enter to it again. Change the text as follows:

// set the mode for detecting hidden text in windows

SetTitleMatchMode, 2

DetectHiddenText, on

// remove all windows from the screen

WinMinimizeAll

// wait a second

Sleep, 1000

// start the installation from the same directory

Run, autoit-v3-setup.exe

// wait for the desired window and click Next

WinWaitActive, AutoIt v3.1.0 Setup

Send, (ENTER)

Send, (ENTER)

// display a window with a message

MsgBox, 0, AutoIt, Setup done

// completion

Exit

Please note how the syntax of the WinWaitActive operator has changed, since now you need to identify the window not by its title, but by the text inside, the detected line is written in the third field. Let's stop the installation again and perform the same operations as in the previous launch. After stopping, you should get a result similar to that shown in the figure.

Everything here is similar to the second step of developing an automation script. We find the line to detect the window and determine which buttons need to be pressed. We write everything into a script. The development of the fourth beat occurs in exactly the same way. In fact, you can run the entire installation in a continuous loop and simply remember the lines that define each of the installer windows and record the keycodes that are entered in this process. Programming in AutoIt is extremely easy. The result is the following program:

// set the mode for detecting hidden text in windows

SetTitleMatchMode, 2

DetectHiddenText, on

// remove all windows from the screen

WinMinimizeAll

// wait a second

Sleep, 1000

// start the installation from the same directory

Run, autoit-v3-setup.exe

// wait for the desired window and click Next

WinWaitActive, AutoIt v3.1.0 Setup

Send, (ENTER)

// similarly, wait for the license agreement

WinWaitActive, License Agreement

Send, (ENTER)

WinWaitActive, Choose Install Location

Send, (ENTER)

// complete installation

WinWaitActive, Click Finish to close

Send, (ENTER)

// display a window with a message

MsgBox, 0, AutoIt, Setup done

// completion

Exit

This program installs AutoIt v3 in automatic mode. It can be converted into executable rather than interpreted code. But I propose to run it completely and then move on to working in AutoIt v3, which will be installed by this moment. First of all, we will use the utility for converting tests from version 2 to version 3 “v2 to v3 Converter”. This approach allows you to immediately obtain a syntactically correct program. Here's the result:

// V2.64 to V3.0.100 (Version 1.0.6)

// Converted with AutoItV2toV3

// (C) Copyright 2004 J-Paul Mesnage.

// set the mode for detecting hidden text in windows

AutoItSetOption("WinTitleMatchMode", 2)

AutoItSetOption("WinDetectHiddenText", 1)

// remove all windows from the screen

WinMinimizeAll()

// wait a second

Sleep (1000)

// start the installation from the same directory

Run("autoit-v3-setup.exe")

// wait for the desired window and click Next

WinWaitActive("AutoIt v3.1.0 Setup")

Send("(ENTER)")

// similarly, wait for the license agreement

WinWaitActive("", "License Agreement")

Send("(ENTER)")

// window with installation location selection

WinWaitActive("", "Choose Install Location")

Send("(ENTER)")

// complete installation

WinWaitActive("", "Click Finish to close")

Send("(ENTER)")

// display a window with a message

$__msgbox = MsgBox (0, "AutoIt", "Setup done")

// completion

Exit

As can be seen from the text, the new syntax does not bring about any significant changes. After conversion, the script was placed in the file setup_autoit3.au3, the extension of which has the standard value for version 3. But the program does everything the same. If you convert it into executable code using the compiler available in version 3, then after removing AutiIt v3 from the system, you can install it again using new program. This will be a performance check.

But just like not all the work system administrator is reduced only to the installation of application software, and the capabilities of AutoIt are not limited to servicing programs such as setup.exe. But more on that in the next part.



1. What is AutoIt3 for?

AutoIt is designed for general automation tasks. To achieve this goal, a standardized BASIC-like programming language was created. This means that if you are already familiar with any scripting programming languages, then you will most likely learn AutoIt v3 with ease.

2. Is AutoIt difficult to learn?

It is very easy to learn AutoIt3, look at the example of calling commands

9. Why, when I try to display the value of a variable using the "Variable value: $variable" construct, do I not get the expected result?

If you have a variable named $msg and you want to output it to MsgBox , then the following will NOT work:

12. How can I terminate a script when I press a hotkey?

If you want to terminate a script when a specific key combination is pressed, use the HotKeySet function, which runs a user-specified function when the specified key combination is pressed. This user-defined function must contain the Exit keyword.

Below is the code that terminates the script when the key combination CTRL+ALT+x is pressed

13. How can I use my own icon for a compiled script?

You need to run the script compiler program (and not just select “Compile” when right-clicking on the script file). This help page describes how the compiler works in more detail. Also use AutoIt3Wrapper to specify the icon in the script itself using directives.

14. How can I prevent a second copy of my script from running?

Use the _Singleton() function. See the User Defined Functions (UDF) help topic for more detailed information on how this function works and how to use it.

15. What are the technical limitations of AutoIt3?

Below you will find the current technical limitations imposed on AutoIt. Keep in mind that some limits are purely theoretical and you will likely reach performance or memory limits before the limit is triggered. Also see the section " "

Meaning Description
2147483647 Maximum length string variable. Considering the 2 GB limit per process and the characters in memory in Unicode, this significantly reduces the specified value
not limited Maximum number of GUI windows
5100 Maximum level of nesting of recursive function calls
not limited Maximum number of user functions
not limited Maximum number of variables used in the script

Number range ate floating point with precision up to 15 decimal places

Integer range: 64-bit signed integer type

0x7FFFFFFFF

Hexadecimal range: 32-bit signed integer
64 Maximum number of dimensions in the array
16 million Total number of elements in the array

16. Why is there an image missing from the help file examples?

This should have been an “Open” button that opens the help examples in the editor window. This kind of error occurs when the hhctrl.ocx library is incorrectly registered in the system or this file is corrupted.
Try registering by running the command "regsvr32 hhctrl.ocx" (Run dialog via Win+R) or check the file's serviceability.


» AutoIt

Overview

AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages ​​(e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.

  • Easy to learn BASIC-like syntax
  • Simulate keystrokes and mouse movements
  • Manipulate windows and processes
  • Interact with all standard windows controls
  • Scripts can be compiled into standalone executables
  • Create Graphical User Interfaces (GUIs)
  • COM support
  • Regular expressions
  • Directly call external DLL and Windows API functions
  • Scriptable RunAs functions
  • Detailed helpfile and large community-based support forums
  • Compatible with Windows XP / 2003 / Vista / 2008 / Windows 7 / 2008 R2 / Windows 8 / 2012 R2 / Windows 10
  • Unicode and x64 support
  • Digitally signed for peace of mind
  • Works with Windows Vista's User Account Control (UAC)

AutoIt has been designed to be as small as possible and stand-alone with no external .dll files or registry entries required making it safe to use on Servers. Scripts can be compiled into stand-alone executables with Aut2Exe.

Also supplied is a combined COM and DLL version of AutoIt called AutoItX that allows you to add the unique features of AutoIt to your own favorite scripting or programming languages!

Best of all, AutoIt continues to be FREE– but if you want to support the time, money and effort spent on the project and web hosting then you may donate.

Download

Features

Here are some of the unique features of AutoIt.

Basic-like Syntax and Rich Function Set

AutoIt has a BASIC-like syntax which means that most people who have ever written a script or used a high-level language should be able to pick it up easily.

Although it started life as a simple automation tool, AutoIt now has functions and features that allow it to be used as a general purpose scripting language (with awesome automation as well of course!). Language features include:

  • The usual high-level elements for functions, loops and expression parsing
  • A staggering amount of string handling functions and a Perl compatible regular expression engine (using the PCRE library).
  • COM support
  • Call Win32 and third-party DLL APIs

Built-in Editor with Syntax Highlighting

AutoIt comes with a customized “lite” version of SciTe that makes editing scripts easy. Users can also that includes additional tools to make things even easier.

Standalone and Small

AutoIt is a very small and standalone application with no reliance on massive runtimes like .NET or VB. All you need to run AutoIt scripts are the main AutoIt executable (AutoIt3.exe) and the script. Scripts can also be encoded into standalone executables with the built-in script compiler Aut2Exe.

International and 64-bit Support

AutoIt is fully Unicode aware and also includes x64 versions of all the main components! How many other free scripting languages can you say that about?

Key and Mouse Simulation

Much time has been spent optimizing the keystroke and mouse simulation functions to be as accurate as possible on all versions of Windows. All the mouse and keyboard routines are highly configurable both in terms of simulation “speed” and functionality.

Window and Control Management

You can expect to move, hide, show, resize, activate, close and pretty much do what you want with windows. Windows can be referenced by title, text on the window, size, position, class and even internal Win32 API handles.

Directly get information on and interact with edit boxes, check boxes, list boxes, combos, buttons, status bars without the risk of keystrokes getting lost. Even work with controls in windows that aren’t active!

Graphical User Interfaces (GUIs)

AutoIt v3 will also allow you to create some complex GUIs – just like those below!

And much, much more.

You’ll probably want to go to the downloads page right now…

OS Windows has gained popularity primarily due to its convenient and intuitive interface. But if the ordinary user only benefited from this, then for the admin push-button control has many inconveniences. Of course, some problems can be solved using console commands and scripts, but not all. And here they come to the rescue special means automation.

AutoIt

One of the most popular automation tools among administrators is AutoIt (autoitscript.com/autoit3), which simulates keystrokes, mouse clicks and other similar actions that a user usually performs when working in GUI applications.

Using AutoIt, all of these movements can be programmed using a BASIC-like language. The program can manage processes, access the Windows API and DLL, the registry, clipboard, files (reading, changing, deleting), creating GUI, messages, data entry forms, working with databases (MySQL and SQLite), reading HTML code, download files, send e-mails and much more. In general, it all depends solely on the desire to tinker with the settings. It is gratifying that AutoIt does not require programming skills from the administrator. In scripts, you can easily access window controls with just a couple of lines of code. However, it should be remembered that AutoIt works without problems with standard Windows windows. If the authors took care of the uniqueness of the interface, you will have to work a little while setting up AutoIt to find the necessary parameters.

Supports Windows from 95 to 2k8, including working in 64-bit versions of the system, and is “friendly” with Vista UAC. It’s convenient that scripts can be compiled into an exe and then executed on another machine. No additional applications or libraries are required.

AutoIt is distributed under a freeware license, allowing its use without restrictions, including for commercial purposes. Installation is standard, there are no additional requirements. The current version is 3, which is syntax incompatible with the previous version 2. The program comes with the SciTE4AutoIt3 script editor, the AU3Check.exe syntax checking utility, ready-made examples, Aut2Exe compiler (and reverse Exe2Aut) and help. During installation, the *.au3 extension will be mapped to the AutoIt interpreter.

The scripting language used in AutoIt is one of its strengths. It is both powerful and simple. For example, to run the program, just write:

That's it, no more action. AutoIt is a great way to automate the installation process for applications that don't support answer files. To catch windows, the WinWaitActive function is usually used to enter parameters, which interrupts script execution until the window is activated. The function parameters should include the window title and optional additional text. The latter allows you to distinguish different windows of the same program from each other. For example, the AutoIt installer windows contain the same title - AutoIt v3.3.6.1.5, that is, if you use:

WinWaitActive("AutoIt v3.3.6.1.5")

This design will match all installer steps. Therefore, it is better to clarify by entering additional text that is displayed in the window, for example:

WinWaitActive("AutoIt v3.3.6.1.5", "License Agreement")

This will definitely take us to the license agreement window. All that remains is to send him confirmation: Send("!y")

As you can see, everything is simple. Along with the programs, the AutoIt Window Info Tool (AU3Info.exe) utility is also installed, which will help you get all the information on the window title, text (displayed and hidden), status bar, location, color, and so on. We just run it and place a cross on the window, after which we read all the values ​​in the Window Info Tool. With its help, it is much easier to collect the necessary information from the experimental program window. Help in AutoIt is very detailed, it has all the details on using the language. In the documentation on the project website you will find a link to a translated version of the help. Plus, numerous specialized forums usually have a separate thread. There shouldn’t be any problems in learning AutoIt; in one evening you can learn how to write simple scripts; complex solutions will naturally require a lot of time.

Xstarter

Another popular program for automating routine system administrator tasks. The developer is our compatriot, Alexey Gilev (xstarter.com/rus), accordingly, xStarter has a localized interface, and most importantly, the program is distributed free of charge for Russian-speaking users.

After installation, xStarter can be launched manually, automatically when the user logs in, or started as Windows service. The latter option allows you to run a task at exactly the specified time, regardless of the user’s registration in the system and other factors, as long as the computer is turned on. It offers periodic execution of tasks, a composite schedule, setting skips and actions for missed tasks, and triggering by event. In general, there are more than enough options. Using xStarter, you can expand the list of hotkeys or redefine their values ​​globally or locally. For example, you can easily make a task run when you press a key combination , but only if Firefox is running.

The running program is placed in the tray; by clicking on the icon, we call up the task editor. In the Sections/Tasks window we will find two dozen examples, as they say, for all cases. Enabled tasks are marked with a green icon.

We select the one that is closest in meaning (or create a new task), copy it using the context menu and edit it to suit your needs. Each task is configured in four tabs. So, in the “Schedule and Information” tab we indicate the name of the task, the time or event at which it will be launched, a key combination and an optionally active program window, when it appears, the task should be executed. The macros themselves are written in the “Actions” tab. Click “New Action” - the settings window appears. On the left side we find presets, divided into several groups, then we specify the parameters on the right side. The remaining task tabs allow you to configure variables, set priority, run in a separate process, and log. Everything is very simple and clear.

To activate blocked functions, you must additionally install the xStartHooks module. In this case, xStarter will behave like a typical Trojan or malicious software - it will begin to intercept system calls, “press” keys and send messages, which may not be liked by antiviruses and fireware. But with some antiviruses (for example, NOD32) this can be easily solved; just add xStarter to the exceptions.

For convenience, macros can be compiled into an exe file; under certain settings, all necessary libraries can be automatically added here. Then we distribute such files to other systems and execute them.

It remains to add that all Windows operating systems from NT4 to 2k8/7 are supported.

On the project forum you can find examples of some popular tasks, including uploading files, sending SMS and e-mail, backup and data synchronization.
A special version of Starter Job Scheduler for Firebird/Interbase is also available on the site; it is designed to execute SQL scripts, backup and restore data in these DBMSs. Another unique opportunity - remote control launching tasks, as well as viewing the log using the special xStarter Web Pilot application.

Automate

Probably the most famous commercial program for automating tasks is AutoMate, developed by Network Automation, Inc (networkautomation.com). Its main feature is the creation of tasks using a convenient GUI, without the need to write code. The entire process is simplified through the use of wizards and a special task editor, Task Builder. The program contains a large number ready-made templates actions and reactions to them, which further simplifies the process of creating a chain of actions. The current version of AutoMate 7 at the time of writing supports more than 230 preset actions that allow you to schedule tasks, work with files and databases, transfer data via FTP/SFTP, encrypt using PGP, monitor systems, access WMI and much more.

AutoMate is available in four editions, all tailored to specific uses: AutoMate Professional and Premium, AutoMateBPAServer 7 Standard and Enterprise. The simplest - AutoMate Professional - provides a convenient interface for creating tasks on the local system. The most advanced - Enterprise - provides opportunities for simple operation accounts and roles, work in AD, centralized management of several machines, SNMP support, telnet and terminal emulator.
All Win OS from XP SP2 to 2k8/7 are supported. For installation you will need Microsoft platform.NET Framework version 3.0.

The actual management is carried out using two consoles - Task Builder and Task Administrator. Tasks are created in Task Builder. This process is quite simple: in the left panel, from the 29 available groups, select the desired action and move it to the middle field with the mouse. A wizard appears to help you refine your settings. For example, let's create an action that allows you to get data on a section hard drive. Go to the menu System –> Get Volume Information, a wizard of the same name appears, consisting of four tabs.

We need to go through and select the parameters in each of them sequentially. In General, we indicate the disk partition and the parameters that we want to receive: type, label, file system, location. Alternatively, you can immediately select All volumes and then, by clicking the icon next to the field, set the verification condition. The program provides a number of built-in variables, functions and triggers that can be used in this field. You can also create your own condition. In other tabs, a description of the task and action in case of errors are specified.
After you create a task, it appears in the list in the middle, where you can edit it, move it, disable it, and so on. Next, select and enter other Actions in the same way. For debugging, you can add breakpoints to the job (Breakpoint, ).

Task Administrator is designed to manage all tasks, both on a local and remote system. Having selected any task in it, we can view its properties, activate it, or create a new task. In the properties of the task, triggers, priority, protection, Account, on behalf of which it will be executed. There are many settings, they are very diverse. Tasks are saved in files with the *.aml extension.

AutoHotkey

AutoHotkey (autohotkey.com) is a fork of AutoIt v2. Its author, Chris Mallett, proposed adding hotkey support to AutoIt, but the idea did not find a response, and as a result, the Initial release was released in November 2003. Unlike its parent product, AutoHotkey is available under the GNU GPL license.

The language syntax is based on AutoIt v2, some ideas are taken from v3. With its help, you can easily automate repetitive tasks: launching a program, sending mail, editing the registry. It supports working with files, simulating mouse button presses, and it is possible to create a GUI. The program can monitor system events and perform actions when they occur.

But the trick of AutoHotkey is the management of hot keys. For example, to launch a calculator with the combination , we write just one line:

The hash mark "#" corresponds to a key . The documentation is very detailed (translation is available at www.script-coding.info/AutoHotkeyTranslation.html), it reflects all the features of the language. In addition to the interpreter itself, the project offers a utility for creating a GUI - SmartGUI Creator and the SciTE4AutoHotkey editor, which has highlighting and code completion.

Scripts (*.ahk extension) can be compiled into an exe file and executed on any computer.

Automatically install Firefox using AutoIt

AutoItSetOption("WinTitleMatchMode", 2)
AutoItSetOption("WinDetectHiddenText", 1)
WinMinimizeAll()
Sleep (1000)
Run("FirefoxSetup3.6.6.exe")
WinWait("Install Mozilla Firefox")
Send("(ENTER)")
WinWait("Mozilla Firefox Installation", "Installation Type")
Send("(ENTER)")
WinWait("Install Mozilla Firefox", "Summary")
Send("(ENTER)")
WinWait("Install Mozilla Firefox", "Shutdown
installation wizard")
Send("(ENTER)")
Exit

AUTOMATION ANYWHERE

The development of the Californian company Tethys Solutions, LLC () has already earned recognition from administrators and received awards from various media publications. With Automation Anywhere, you can easily automate any repetitive task, simple or complex, without the need for programming.

I’ll say right away that the product is very serious and has a huge number of possibilities. The program can work with files, send mail, run tasks according to a plan or when a trigger is fired, use VBS and JavaScript scripts and much more. The technology, called “SMART Automation Technology,” eliminates the need for an administrator to also be a programmer. Recording can be done automatically, when the computer records all user actions. In the future, such a task, immediately or after editing, can be “scrolled” on other systems, watching how the mouse itself runs across the screen and presses buttons. The program offers two recorders: Object Recorder for desktop applications and Web Recorder for recording sequences of actions in a web browser.

Moreover, Web Recorder latest version The program supports all the main technologies used in the web: Java, JavaScript, AJAX, Flash, frames. The process is quite simple: launch Automation Anywhere, select the recorder, and the program begins recording all user actions. To stop, press the combination or click on the “Stop” icon in the floating window at the bottom of the screen. At the end of the process, the program will offer to save the recording to a file (extension *.atmn). Editing, as well as manual creation of a task, is done using the Task Editor.

The developers have already included several task templates in the program that can be used as examples. Editing a recorded task also does not require knowledge of code. By clicking the Edit button, we will see the entire sequence of actions performed on the screen (mouse movements, keystrokes).

The left editor window shows predefined commands, divided into categories, that can be added to the task. It has everything: working with files and directories, backup, Excel tables, connecting to the Internet, sending e-mail, capturing desktop images, starting/stopping services. Select the desired task and simply drag it into the right window. A properties editing window immediately opens, in which we fill in the proposed parameters (they are specific for each item). The editor supports additional scripts, working with variables, debugging and much more.

The created task can be exported to an executable file and distributed to other systems.

The task can start by time or when a trigger is fired, this behavior is configured in Trigger Manager, here you can choose: launching a window with a certain text, appearance of a file in the directory, resource load (CPU, memory, free space), start/stop of a process or service, receiving a specific e-mail. The developers did not forget about security - Automation Anywhere allows you to protect the script with a password and encrypt it.

In general, everything you need is in the program, the only thing missing is localization. Automation Anywhere supports all versions of Windows: from XP to 2k8/7.

Conclusion

In fact, there are much more programs for automating routine tasks. Paid versions are distinguished by greater convenience and a friendly interface, the ability to work in a network environment. Although, depending on your preparation and desire to tinker with the settings, you can get by with free programs like xStarter, AutoIt or AutoHotkey.

Standard Windows Task Scheduler

Microsoft finally realized the need for a proper scheduler, and, starting with Vista, the system received an improved Task Scheduler (Administration.. Task Scheduler, or taskschd.msc) - significantly redesigned compared to previous versions. Its interface allows you to connect to another computer for configuration, create (simple and advanced versions) or import a task. Thus, the main elements of the task were Triggers, Actions, Conditions and Settings. The trigger determines when and upon the occurrence of what event to run the task: by time, when the computer is turned on, when you log in, or when an event appears in the log. In the latter case, you must specify the log where the event will be tracked, the source and event code.

Conditions and parameters clarify the essence of the task, and the action determines what can actually be done (launch a program, send a message). The ability to delay starting a task allows you to delay the start in situations where its immediate start is unacceptable (for example, high system load). Conditions specify other options for executing a task, for example, while the computer is idle.

This article appeared on the site due to the popularity of AutoIt among visitors to the Automatic Windows Installation forum. The article consists of two parts. The first contains an introduction to AutoIt, taken entirely from the Russian help for AutoIt, which was very competently translated from English by Valery Ivanov. Unfortunately, it was not possible to find the author’s contact information, but I would like to believe that he does not object to the publication of his works. I highly recommend downloading the help and reviewing lessons, from which you will immediately learn how easy it is to automate application installations using AutoIt. The second part of the article is a list of frequently asked questions at the Oszone conference about working with AutoIt. The answers are, of course, included. "Oszone AutoIt FAQ" has been prepared for you.

Introduction to AutoIt

AutoIt v3 is a BASIC-like scripting language. Its main purpose is to automate work with Windows GUI (MS Windows graphical user interface). To accomplish this complex task, a combination of proven techniques is provided, including simulating keyboard keystrokes, mouse pointer movements, and window and visual element manipulation. Experience has shown that these "drive belts" are very effective in producing workable solutions in situations where others standard means(for example, VBScript and SendKeys) are powerless.

AutoIt was intended to be a means of “replicating configurations” of a PC. But since the creation of the third version, its capabilities can be used to implement the “kitchen” of automation - writing scripts for solving various problems, including for system administration.

AutoIt can:

  • Simulate pressing keyboard combinations (most keyboard layouts are supported)
  • Simulate mouse pointer movements and button clicks
  • Move, resize and control window display options
  • Directly interact with the “controls” of the window (get/change the caption, move, disable, etc. actions)
  • Work with the clipboard to transfer its text content
  • Read, change and create registry keys and values

The new version of AutoIt3 recognizes common constructs and has a standard syntax reminiscent of VBScript and BASIC, and supports processing complex expressions, executing custom functions, and performing cyclic and conditional calculations. In addition, AutoIt3 is designed for everything that veteran screenwriters have been using for a long time.

As before, AutoIt has a small interpreter size (~100KB), which is independent and does not refer to other than system .dll libraries. He deliberately does not make independent or hidden entries in the register, except for those that are mandatory and part of the process. complete installation. Scripts can be compiled into independent executables using the supplied script compiler - Aut2Exe.

Along with the interpreter, the ActiveX and DLL version of AutoIt are upgraded, called AutoItX3. This library is a combined composite (COM and a standard DLL library in one module). AutoItX3 allows you to add unique AutoIt features to applications you write in other programming languages!

And finally, most significant is the fact that AutoIt remains free. However, if you are able to support this project with your time, money or other efforts, then all types of donations are accepted on the AutoIt home page.

Oszone AutoIt FAQ

Read the manual for AutoIt - a lot will become clearer :) What is stated below is something like a brief reference and a part-time FAQ.

Launching applications

  1. Normal launch
    Run("C:\Program Files\RivaTuner\RivaTuner.exe")
    ;or like this:
    FileChangeDir("C:\Program Files\RivaTuner\")
    Run("RivaTuner.exe")
    To universalize scripts, use macros, for example, instead of " C:\Program Files"It's much more practical to use a macro @ProgramFilesDir. Then the application launch command will look like this:
    Run(@ProgramFilesDir & "\RivaTuner\RivaTuner.exe")

    For a complete list of macros, see the manual section " Macro Reference".

  2. With completion waiting (useful for silent installation of applications)
    RunWait("RivaTuner20RC158.exe /s")
    Please note that the first argument to the functions Run And RunWait is FULL path To executable file. You can write one name only in two cases - if the script is located in the same directory or after first changing the working directory with pom. functions FileChangeDir.

System Variables

  1. In principle, macros duplicate most system variables, but not all. You can get directly to their values ​​using the help. functions EnvGet, For example:
  2. Adding a path to a variable Path: ;for example, add the path to 7-Zip in Path$addtopath="%ProgramFiles%\7-Zip" $smcur="HKEY_LOCAL_MACHINE\SYSTEM\ControlSet" & StringFormat("%03s",RegRead("HKEY_LOCAL_MACHINE\SYSTEM\Select","Current")) & "\Control\ Session Manager\Environment" $syscurpath=RegRead($smcur,"Path")



Top