Using autoit can save you a lot of time

Source: Internet
Author: User

1. Introduction

Autoit is a tool similar to the Basic Scripting Language used to create scripts that automatically complete repetitive tasks, such as automatically logging on to QQ, logging on to the mailbox, and logging on to the game client.

Features:

L The syntax is similar to basic, which is very simple. Junior High School Students can definitely learn

L The Chinese version is available for ease of use

L rich help documents and function libraries

L there are a lot of online materials. Chinese and English forums are very active, and answers are easy to find.

L Unicode support

L compatible with most Windows operating systems

L support UAC access control of Vista

L and so on

What can be done:

L run Windows and DOS Programs

L simulate keyboard buttons, such as clicking, double-clicking, and right-clicking

L simulate mouse movement and click to control the movement speed

L create, move, resize, and close windows

L access the controls in the window, such as text boxes and drop-down boxes, and you can obtain, set, and select texts.

L copy and paste with the clipboard

L open, read, write, and close files accessing external disks

L access the external database. The standard is SQLite.

L supports network communication protocols, such as HTTP, FTP, TCP, and UDP

L access the Registry

L Win32 APIs can be called.

L can be compiled into an EXE file for easy execution

L and so on

2. Installation

The official website is http://www.autoitscript.com.

The Chinese forum is a http://www.autoitx.com and can only be registered between PM and PM.

The software has a Chinese version. You can select the original or Chinese version.

The directory structure after installation is as follows:

Explain the meanings of key directories and files:

How to package a script file into an EXE file in the aut2exe folder

The autoitx folder contains ActiveX, which is used by other programs to use autoit through DLL.

The extras folder contains screen recording software, which can be used for screen recording and playback. You can directly modify the screen recording script.

Au3info.exe is a tool used to capture window information. It is very important and useful.

Au3tool.exe is a script editor that is very important and useful.

Autoit3chs. CHM is a Chinese help document and must be read through

Udfs3chs. CHM is a help document for user-defined functions. There are also a large number of functions that call Win32 APIs.

Jian Li .doc is the resume of the Chinese author, not my advertisement post

3. Use

The help documentation provides detailed instructions, which I will not repeat.

Window information tools are very useful,

The implementation idea is to capture the window and then find the control of the window. Controls are defined as follows:

These contents are embodied in gadgets. Therefore, it is convenient to use autoit for development.

Note:After the operating process is restarted, these identifiers of the control change..

When writing a script, there are several errors:

L use semicolons (;) instead of double slashes (;) for comments

L The Judgment statement uses if .... Then .... Endif

L function definition using fun... Endfunc

L The msgbox function has three parameters and must be input.

L use "&" for String concatenation

L exit the loop and use exitloop

L the error message is in @ Error

4. Module Development

To write a large program, you must be allocated multiple files, as long as one is the main file. Some variable definitions should also be placed in a unified place, which is very beneficial.

For example, in my application, I divided a lot of files, each of which has different functions. Put the common content in a file.

There are au3 files in the project, which are essential scripts; EXE files are compiled executable files; INI files are client-side information that is easy to change, such as user names and passwords; the jar file encapsulates the operations for Java to call the EXE file.

5. Package and release

You can use au2exe to compile the script into an EXE file.

If you want to compile it into a console program, check the last one.

6. Common functions

Winactivate activation window

Controlclick

Mousemove move cursor

Mousedown

Sleep program sleep

Lelewrite output to the console

Send keyboard Information

Controlgetpos: Obtain the Coordinate Position of the control.

Controlcommand controls the text box, drop-down box text, and options

Commonly used functions that call Win32 APIs

_ Winapi_getwindow

7. Conclusion

Autoit can traverse processes and obtain handles. If you want to stabilize the control program, you need to use the process and handle. You can use the spy4win tool to catch the handle.

In the process of learning and using autoit, I encountered many problems and consulted a lot of information. The above is my work experience and I hope it will be useful to you.

Believe me,UseAutoit, Saving you a lot of time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.