不僅在窗口操作及模擬鍵擊功能上有所不同,AutoIt v3 跟 v2.64 及更舊版本是有很大的區(qū)別的,但我們?nèi)蕴峁?v2.64 版本的下載,結(jié)果就有些用戶嘗試轉(zhuǎn)換已有的腳本。但是 v3 具有許多以往版本沒有的性能,使得完成GUI自動(dòng)化操作更加輕松簡單,因此它是更好的一般用途的腳本語言。
在您著手入門 v3 之前閱讀以下說明將更利于學(xué)習(xí)。另外要提一下的是,在 AutoIt 安裝目錄下的“Extra”文件夾里有一個(gè)從 v2.64 到 v3 的腳本轉(zhuǎn)換工具。
- 反斜線字符不再是特殊字符,但也許引號(hào)卻成為新的問題....
例如, Run('C:\Windows\Notepad.exe "C:\Some
File.txt" ')
- 命令行語法:
只有腳本模式,比如 AutoIt.exe <腳本文件名>
- 變化:
以往的 <命令>, <參數(shù)1> [,<參數(shù)2>]
已變成 命令(參數(shù)1 [,參數(shù)2]) 這種函數(shù)形式。
- 隨著對(duì)循環(huán)及自定義函數(shù)的支持,Goto 已不再存在。
- AutoItv3 可以支持大多編程語言都有的變量類型,比如 $myVar
= "Example of assignment"
- 腳本文件的擴(kuò)展名從 .aut 變成 .au3。
如果您希望把某個(gè) 2.64 版本的腳本改寫成 v3 的,下面這個(gè)表格應(yīng)該會(huì)對(duì)您有用:
2.64 版本的函數(shù) | V3 版本中的替代函數(shù) |
AdlibOn | AdlibEnable |
BlockInput | BlockInput |
Break | Break |
DetectHiddenText | AutoItSetOption("WinDetectHiddenText",...) |
Exit | Exit |
EnvAdd | [見 + 運(yùn)算符的說明] |
EnvDiv | [見 / 運(yùn)算符的說明] |
EnvMult | [見 * 運(yùn)算符的說明] |
EnvSub | [見 - 運(yùn)算符的說明] |
FileAppend | [FileOpen(...,2) 然后再使用 FileWriteLine] |
FileCopy | FileCopy |
FileCreateDir | DirCreate |
FileDelete | FileDelete or FileRecycle |
FileInstall | FileInstall |
FileReadLine | FileReadLine |
FileRemoveDir | DirRemove |
FileSelectFile | FileOpenDialog or FileSaveDialog |
Gosub | [見 Func...EndFunc] |
Return | [見 Func...EndFunc] |
Goto | [不再需要] |
HideAutoItDebug | -- |
HideAutoItWin | AutoItSetOption("TrayIconHide",...) |
IfInString | If StringInStr(...) Then |
IfNotInString | If Not StringInStr(...) Then |
IfWinExist | If WinExists(...) Then |
IfWinNotExist | If Not WinExists(...) Then |
IfWinActive | If WinActive(...) Then |
IfWinNotActive | If Not WinActive(...) Then |
IfEqual | [見 = 和 == 運(yùn)算符的說明] |
IfNotEqual | [見 <> 運(yùn)算符的說明] |
IfGreater | [見 > 運(yùn)算符的說明] |
IfGreaterOrEqual | [見 >= 運(yùn)算符的說明] |
IfLess | [見 < 運(yùn)算符的說明] |
IfLessOrEqual | [見 <= 運(yùn)算符的說明] |
IfExist | FileExists |
IfNotExist | If Not FileExists(...) Then |
IfMsgBox | [見 MsgBox(...) 和 Select...Case...EndSelect] |
IniRead | IniRead |
IniWrite | IniWrite |
IniDelete | IniDelete |
InputBox | InputBox |
LeftClick | MouseClick("left",...) |
RightClick | MouseClick("right",...) |
LeftClickDrag | MouseClickDrag("left",...) |
RightClickDrag | MouseClickDrag("right",...) |
MouseGetPos | MouseGetPos |
MouseMove | MouseMove |
MsgBox | MsgBox |
Random | Random |
RegRead | RegRead |
RegWrite | RegWrite |
RegDelete | RegDelete |
Repeat | [見 For...Next] |
EndRepeat | [見 For...Next] |
Run | Run |
RunWait | RunWait |
Send | Send |
SetCapslockState | SendSetCapslockState |
SetEnv | EnvSet |
SetBatchLines | -- |
SetKeyDelay | AutoItSetOption("SendKeyDelay",...) |
SetStoreCapslockMode | AutoItSetOption("SendCapslockMode",...) |
SetTitleMatchMode | AutoItSetOption("WinTitleMatchMode",...) |
SetWinDelay | AutoItSetOption("WinWaitDelay",...) |
Shutdown | Shutdown |
Sleep | Sleep |
SplashTextOn | SplashTextOn 和其它 |
SplashTextOff | SplashOff |
StringCaseSense | [見各自的函數(shù)說明] |
StringLeft | StringLeft |
StringRight | StringRight |
StringMid | StringMid |
StringLen | StringLen |
StringReplace | StringReplace |
StringTrimLeft | StringTrimLeft |
StringTrimRight | StringTrimRight |
StringGetPos | StringInStr |
WinGetActiveStats | [見 WinGetPos, WinGetTitle, WinGetText] |
WinGetActiveTitle | WinGetTitle("") |
WinKill | WinKill |
WinWait | WinWait |
WinWaitClose | WinWaitClose |
WinWaitActive | WinWaitActive |
WinWaitNotActive | WinWaitNotActive |
WinHide | WinSetState(..., @SW_HIDE) |
WinShow | WinSetState(..., @SW_SHOW) |
WinRestore | WinSetState(...,@SW_RESTORE) |
WinMinimize | WinSetState(...,@SW_MINIMIZE) |
WinMaximize | WinSetState(...,@SW_MAXIMIZE) |
WinActivate | WinActivate |
WinClose | WinClose |
WinMove | WinMove |
WinSetTitle | WinSetTitle |
WinMinimizeAll | WinMinimizeAll |
WinMinimizeAllUndo | WinMinimizeAllUndo |
#Include | #Include |
%CLIPBOARD% | [見 ClipGet 和 ClipPut] |
A_OSTYPE | @OSType |
A_OSVERSION | @OSVersion |
A_SCRIPTNAME | @ScriptName |
A_SCRIPTDIR | @ScriptDir |
A_SCRIPTFULLPATH | @ScriptFullPath |
A_WORKINGDIR | @WorkingDir |
A_NUMBATCHLINES | -- |
A_SEC | @SEC |
A_MIN | @MIN |
A_HOUR | @HOUR |
A_MDAY | @MDAY |
A_MON | @MON |
A_YEAR | @YEAR |
A_WDAY | @WDAY |
A_YDAY | @YDAY |