#include <WinAPI.au3>
#include <SendMessage.au3>
;--------------------------------------------------------------;脚本开始
Opt("TrayIconDebug", 1) ;0=无信息, 1=调试信息
Opt("WinTextMatchMode", 2) ;1=完全匹配, 2=快速匹配
Opt("WinTitleMatchMode", 4) ;1=开头, 2=子串, 3=完全, 4=高级
Opt("WinSearchChildren", 1) ;0=不搜索, 1=搜索子窗口
Opt("WinDetectHiddenText", 1) ;0=不检测, 1=检测
;--------------------------------------------------------------;设置脚本参数
$WinTitle_1= '迅雷7安装程序'
$Wintxt_1= '软件许可协议'
$Wintxt_2= 'C:\Program Files\Thunder Network\Thunder'
$Wintxt_3= ''
Local $iX, $iY
$hwnd = WinGetHandle($WinTitle_1);获取窗口句柄
$Hwnd_Button1 = _WinAPI_GetDlgItem($hwnd, 1040) ;启动迅雷7”的按键的句柄
#cs
$Hwnd_Button2 = _WinAPI_GetDlgItem($hwnd, 1041) ;将迅雷看看设为首页”的按键的句柄
$Hwnd_Button3 = _WinAPI_GetDlgItem($hwnd, 1043) ;查看新版本特性”的按键的句柄
$Hwnd_Button4 = _WinAPI_GetDlgItem($hwnd, 1007) ;完成”的按键的句柄
#ce
$tRect = _WinAPI_GetWindowRect($Hwnd_Button1)
$iLeft = DllStructGetData($tRect, "Left") ;屏幕左侧距离
$iTop = DllStructGetData($tRect, "Top") ;屏幕顶部距离
$iRight = DllStructGetData($tRect, "Right") ;屏幕右侧距离
$iButton = DllStructGetData($tRect, "Bottom") ;屏幕底部距离
;$iRight - $iLeft 控件的宽度
;$iButton - $iTop 控件的高度
$iX = $iLeft + ($iRight - $iLeft) / 2 ;取控件的中央点
$iY = $iTop + ($iButton - $iTop) / 2 ;取控件的中央点
Local $ilParam = BitOR($iY * 65536, BitAND($iX, 65535))
;----------------------------------------------------------------;执行程序
$Exe = 'Thunder7.1.8.2298.exe'
If ProcessExists($Exe) Then ProcessClose($Exe)
If Run($Exe) = 0 Then ShellExecute($Exe)
Do
Sleep(10);
Until WinExists($Wintitle_1)
;WinMove($Wintitle_1, "", -1000, -1000)
;--------------------------------------------------------------;程序启动,显示界面
WinWaitActive($Wintitle_1, $Wintxt_1)
ControlClick($Wintitle_1, $Wintxt_1, "Button1");---------------;点击按钮控件: 接受
WinWaitActive($Wintitle_1, $Wintxt_2)
ControlClick($Wintitle_1, $Wintxt_2, "Button7");---------------;点击按钮控件: 开机启动迅雷7
Sleep(500)
Send("{ENTER}")
ControlClick($Wintitle_1, $Wintxt_2, "Button1");---------------;点击按钮控件: 下一步
Sleep(500)
Send("{ENTER}")
WinWaitActive($WinTitle_1,$Wintxt_3,)
_SendMessage($Hwnd_Button1, 0x0201, $ilParam) ;发送鼠标消息
_SendMessage($Hwnd_Button1, 0x0202, $ilParam)
这是我的代码,希望论坛老大能帮我看看。