b0123 windows自动化工具 autoit 使用

说明

AutoIt 目前最新是v3版本,这是一个使用类似BASIC脚本语言的免费软件,
它设计用于Windows GUI(图形用户界面)中进行自动化操作。它利用模拟键盘按键,
鼠标移动和窗口/控件的组合来实现自动化任务。
而这是其它语言不可能做到或无可靠方法实现的(例如VBScript和SendKeys).

执行 Windows 及 DOS 下的可执行文件

模拟鼠标移动和点击动作。

模拟击键动作(支持大多数的键盘布局)

直接与窗口的“控件“交互(设置/获取 文字、移动、关闭,等等)

对窗口进行移动、调整大小和其它操作。

配合剪贴板进行剪切/粘贴文本操作

安装

版本v3 

汉化,没有编辑器

http://www.downcc.com/soft/91063.html

E:\Programs\autoit3

 

安装版,英文

http://forspeed.onlinedown.net/down/autoit-v3-setup.zip

C:\Program Files (x86)\AutoIt3

 

目录结构

 

 

使用

编辑和运行程序

SciTE 目录下的程序是编辑器。 可以双击打开创建程序。 也可以右键已有的程序编辑打开。

程序文件扩展名 au3  .Examples 下有例子。

可以右键编辑打开。   Toos/Go F5 运行。

也可以右键直接运行。 也有命令行工具

提供了工具 编译成exe文件

分析

双击 Au3Info_x64.exe  或 Au3Info.exe  ,打开如图程序。 鼠标点击 查询工具,点击拖动到目标窗口或控件上,会获取相应的信息,这些是接下来程序用到的

 

 

 

notepad1.au3

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Jonathan Bennett (jon@hiddensoft.com)
;
; Script Function:
;   Opens Notepad, types in some text and then quits.
;


; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
Local $answer = MsgBox(4, "AutoIt 例子 (中文)", "这个例子会在运行记事本后输入一些文字并退出.  运行?")


; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(0, "AutoIt", "好的,再见!")
    Exit
EndIf


; Run Notepad
Run("notepad.exe")


; Wait for the Notepad become active - it is titled "Untitled - Notepad" on English systems
WinWaitActive("[CLASS:Notepad]")


; Now that the Notepad window is active type some text
Send("Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")
Sleep(500)
Send("+{UP 2}")
Sleep(500)


; Now quit by pressing Alt-f and then x (File menu -> Exit)
Send("!f")
Send("x")


; Now a screen will pop up and ask to save the changes, the window is called
; "Notepad" and has some text "Yes" and "No"
WinWaitActive("记事本", "")
Send("n")


; Now wait for Notepad to close before continuing
WinWaitClose("[CLASS:Notepad]")


; Finished!

 

D:\code\other\脚本\example_2022.au3

 

 

资料

Autoit 3 常用的语句 ,天祈笨笨, 2017-09-26

AutoIt3相关——基本使用篇,lhzb8866,2021-05-21

 
posted @ 2022-07-24 16:41  sunzebo  阅读(581)  评论(0编辑  收藏  举报