

//如何模拟点击TNewButton1和TNewCheckBox1控件
ControlClick(WinGetHandle("Select Setup Language"), "", "[CLASSNN:" & "TNewButton1" & "]")
ControlClick($hWnd, "", "[CLASSNN:" & "TNewCheckBox1" & "]")
//获取一个窗口或一个控件的句柄并显示出来
#include <MsgBoxConstants.au3>
#include <WinAPI.au3>
Local $sWindowTitle = "Installer" ; 窗口标题
Local $sControlClass = "TGetItInstallBtn" ; 控件名,注意不要加实例值,如写成TGetItInstallBtn1就获取不到
Local $hWnd = WinGetHandle($sWindowTitle)
;Local $sWindowClass = "Your_Window_Class" ; 如果窗口没有标题就用这两句,替换成窗口的类名
;Local $hWnd = WinGetHandle("[CLASS:" & $sWindowClass & "]")
If @error Or $hWnd = 0 Then
MsgBox($MB_ICONERROR, "Error", "Window not found!")
Exit
EndIf
Local $hControl = ControlGetHandle($hWnd, "", "[CLASS:" & $sControlClass & "]")
If @error Or $hControl = 0 Then
MsgBox($MB_ICONERROR, "Error", "Button control not found!")
Exit
EndIf
MsgBox($MB_ICONINFORMATION, "Control Handle", "The handle of the control is: " & $hControl &"The handle of the Windows is:" &$hWnd)
//判断一个命令有没有执行成功,方法不好用,有是显示成功也没有变
Local $Result=ControlClick(WinGetHandle("Installer"), "", "[ID:" & "263634" & "]")
if $Result=1 Then
MsgBox($MB_ICONERROR, "Error", "OK")
Exit
Else
MsgBox($MB_ICONERROR, "Error", "NO")
Exit
EndIf