; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: A.N.Other ; ; Script Function: ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder) ; ^!D:: #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. ;SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. driver_path := "\\nas-e5-dd-10\SYS\WIN\Driver\IBMx60\MyDrivers\update" SetWorkingDir %driver_path% RegRead, lang, HKEY_LOCAL_MACHINE, SYSTEM\CurrentControlSet\Control\Nls\Language, Default ;SetWorkingDir %A_WorkingDir% ;Goto, DIRECTX_RUNTIME_FOR_JUNE_2007 WaitDevmgmt() ;Checkpath=%A_ComputerName%\其它设备\视频控制器(VGA 兼容) Checkpath=%A_ComputerName%\显示卡\Mobile Intel(R) 945 Express Chipset Family ret := DevMgmt_SetPath(Checkpath)+0 ;ret := 1 if( ret == 0 ){ ;MsgBox, Text-%OutputVar% /* if (lang = 0804) { title := "Intel® Graphics Media Accelerator Driver" include_txt := "欢迎使用安装程序" }else if( lang = 0411 ) { title := "VMware Tools セットアップ" include_txt := "WixUI_Bmp_Dialog" }else if( lang = 0412 ) { title := "VMware Tools 설치" include_txt := "WixUI_Bmp_Dialog" } run,thinkpad_intel_614104926_xp.exe WinWait, %title%, , 30 WinWaitAndClikButton(title,"Button1",include_txt) if (lang = 0804) { include_txt := "许可协议" }else if( lang = 0411 ) { include_txt := "WixUI_Bmp_Dialog" }else if( lang = 0412 ) { include_txt := "WixUI_Bmp_Dialog" } WinWaitAndClikButton(title,"Button1",include_txt) if (lang = 0804) { include_txt := "Readme 文件信息" }else if( lang = 0411 ) { include_txt := "WixUI_Bmp_Dialog" }else if( lang = 0412 ) { include_txt := "WixUI_Bmp_Dialog" } WinWaitAndClikButton(title,"Button1",include_txt) sleep,5000 if (lang = 0804) { include_txt := "安装进度" }else if( lang = 0411 ) { include_txt := "WixUI_Bmp_Dialog" }else if( lang = 0412 ) { include_txt := "WixUI_Bmp_Dialog" } WinWaitAndClikButton(title,"Button1",include_txt) if (lang = 0804) { include_txt := "安装完毕" }else if( lang = 0411 ) { include_txt := "WixUI_Bmp_Dialog" }else if( lang = 0412 ) { include_txt := "WixUI_Bmp_Dialog" } ControlCheck(title,"Button3",include_txt) WinWaitAndClikButton(title,"Button1",include_txt) */ title := "Intel® Graphics Media Accelerator Driver" run,thinkpad_intel_614104926_xp.exe WinWait, %title%, , 30 cmds := Object() idx :=0 if (lang = 0804) { cmds[++idx] := [ 100, "WinWaitAndClikButton", title, "Button1" , "欢迎使用安装程序"] cmds[++idx] := [ , , , , "许可协议"] cmds[++idx] := [ , , , , "Readme 文件信息"] cmds[++idx] := [ 5000, , , , "安装进度"] cmds[++idx] := [ 100, "ControlCheck" , , "Button3" , "安装完毕"] cmds[++idx] := [ , "WinWaitAndClikButton" , , "Button1" , "安装完毕"] } do_all_commands( cmds ) } WaitDevmgmt() ;Checkpath=%A_ComputerName%\其它设备\High Definition Audio 总线上的音频设备 Checkpath=%A_ComputerName%\声音、视频和游戏控制器\SoundMAX Integrated Digital HD Audio ret := DevMgmt_SetPath(Checkpath)+0 ;;ret := 1 if( ret == 0 ){ run,Lenovo_thinkpad_Audio_7ka117ww_DRV201204250000.exe title := "Setup - ThinkPad Audio Features XII for Windows XP" cmds := Object() idx :=0 if (lang = 0804) { cmds[++idx] := [ 100, "WinWaitAndClikButton2", title, "TNewButton1" , 1, "Welcome to the ThinkPad Audio Features XII for Windows XP Setup Wizard"] cmds[++idx] := [ , "ControlCheck", , "TNewRadioButton1" , "License Agreement"] cmds[++idx] := [ , "WinWaitAndClikButton2" , , "TNewButton2",1,"License Agreement"] cmds[++idx] := [ , "WinWaitAndClikButton2" , , "TNewButton3",1,"Select Destination Location"] cmds[++idx] := [ , "WinWaitAndClikButton2" , , "TNewButton3",1,"Ready to Install"] cmds[++idx] := [ 5000, "WinWaitAndClikButton2" ,title, "TNewButton3",1,"Completing the ThinkPad Audio Features XII for Windows XP Setup Wizard"] title := "SoundMAX - InstallShield Wizard" cmds[++idx] := [ 100, "WinWaitAndClikButton",title, "Button1", "欢迎使用 SoundMAX InstallShield Wizard"] cmds[++idx] := [ , , , "Button2", "许可证协议"] cmds[++idx] := [ 20000, "ControlCheck" , title, "Button2" , "InstallShield 完成"] cmds[++idx] := [ 100, "WinWaitAndClikButton" , , "Button4" , "InstallShield 完成"] } do_all_commands( cmds ) } WaitDevmgmt() ;;Checkpath=%A_ComputerName%\其它设备\High Definition Audio 总线上的调制解调器设备 Checkpath=%A_ComputerName%\调制解调器\ThinkPad Modem ret := DevMgmt_SetPath(Checkpath)+0 ;;ret := 1 if( ret == 0 ){ run,Modem[7fmb14ww].exe title := "Setup - ThinkPad Modem Software" cmds := Object() idx :=0 if (lang = 0804) { cmds[++idx] := [ 100, "WinWaitAndClikButton2", title, "TNewButton1" , 1, "Welcome to the ThinkPad Modem Software Setup Wizard"] cmds[++idx] := [ , "ControlCheck", , "TNewRadioButton1" , "License Agreement"] cmds[++idx] := [ , "WinWaitAndClikButton2" , , "TNewButton2",1,"License Agreement"] cmds[++idx] := [ , "WinWaitAndClikButton2" , , "TNewButton3",1,"Select Destination Location"] cmds[++idx] := [ , "WinWaitAndClikButton2" , , "TNewButton3",1,"Ready to Install"] cmds[++idx] := [ 5000, "WinWaitAndClikButton2" ,title, "TNewButton3",1,"Completing the ThinkPad Modem Software Setup Wizard"] title := "设备驱动程序安装向导" cmds[++idx] := [ 10000, "WinWaitAndClikButton",title, "Button1", "欢迎使用设备驱动程序安装向导。"] title := "NetWaiting Setup" cmds[++idx] := [ 10000, "WinWaitAndClikButton",title, "Button1", "欢迎使用 NetWaiting InstallShield Wizard"] cmds[++idx] := [ 100, , , "Button2", "许可证协议"] cmds[++idx] := [ , , , "Button1", "选择目的地位置"] cmds[++idx] := [ , , , "Button2", "选择程序文件夹"] cmds[++idx] := [ 10000, "WinWaitAndClikButton" , , "Button4" , "安装程序已完成在计算机中安装 NetWaiting。" ] title := "Digital Line Detect Setup" cmds[++idx] := [ 100, "WinWaitAndClikButton", title, "Button1", "欢迎使用 Digital Line Detect InstallShield Wizard"] cmds[++idx] := [ , , , "Button2", "许可证协议"] cmds[++idx] := [ , , , "Button2", "选择程序文件夹"] cmds[++idx] := [ 5000, "WinWaitAndClikButton" , title , "Button4" , "InstallShield Wizard 完成" ] title := "设备驱动程序安装向导" cmds[++idx] := [ 1000, "WinWaitAndClikButton",title, "Button1", "已完成设备驱动程序安装。"] } do_all_commands( cmds ) } WaitDevmgmt() ;;Checkpath=%A_ComputerName%\其它设备\网络控制器 Checkpath=%A_ComputerName%\网络适配器\11a/b/g/n Wireless LAN Mini-PCI Express Adapter ret := DevMgmt_SetPath(Checkpath)+0 if( ret == 0 ){ run,atheros_wlan_1000247_xp32.exe title := "设备驱动程序安装向导" cmds := Object() idx :=0 if (lang = 0804) { title := "设备驱动程序安装向导" cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button2", 1, "欢迎使用设备驱动程序安装向导!"] cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button7", 2, "正在完成设备驱动程序安装向导"] } do_all_commands( cmds ) } /* { ;;红外线驱动 run,microsoft_ir_60600118000_32.exe title := "设备驱动程序安装向导" cmds := Object() idx :=0 if (lang = 0804) { title := "设备驱动程序安装向导" cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button2", 1, "欢迎使用设备驱动程序安装向导!"] cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button7", 2, "正在完成设备驱动程序安装向导"] } do_all_commands( cmds ) } */ /* run,fpr[83f505ww-32].exe title := "WinRAR 自释放格式档案文件" title2 := "浏览文件夹" cmds := Object() idx :=0 if (lang = 0804) { cmds[++idx] := [ 100, "ClikButtonAndWaitWin",title, "Button1", "安装进程", title2, "请选择目标文件夹" ] ;cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button7", 2, "正在完成设备驱动程序安装向导"] } do_all_commands( cmds ) RETRY_MAKE_DIR: Checkpath=D:\_tmp FileCreateDir, %Checkpath% GetDirTreeHandles() ret := DirTreeView_SetPath(Checkpath)+0 cmds := Object() idx :=0 if( ret == 1 ){ if (lang = 0804) { cmds[++idx] := [ 100, "WinWaitAndClikButton",title2, "Button2", "请选择目标文件夹" ] ;cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button7", 2, "正在完成设备驱动程序安装向导"] } do_all_commands( cmds ) }else{ if (lang = 0804) { cmds[++idx] := [ 100, "WinWaitAndClikButton",title2, "Button3", "请选择目标文件夹" ] ;cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button7", 2, "正在完成设备驱动程序安装向导"] } do_all_commands( cmds ) goto, RETRY_MAKE_DIR } cmds := Object() idx :=0 if (lang = 0804) { cmds[++idx] := [ 100, "WinWaitAndClikButton",title, "Button2", "安装进程" ] ;cmds[++idx] := [ 100, "WinWaitAndClikButton2",title, "Button7", 2, "正在完成设备驱动程序安装向导"] } do_all_commands( cmds ) */ cmds := Object() idx :=0 title := "ThinkVantage 指纹软件 安装" cmds[++idx] := [ 100, "WinWaitAndClikButton",title, "Button1", "欢迎使用 ThinkVantage 指纹软件 安装向导" ] cmds[++idx] := [ 100, "WinWaitAndClikButton",title, "Button1", "欢迎使用 ThinkVantage 指纹软件 安装向导" ] do_all_commands( cmds ) WaitDevmgmt() Sleep,1000 exit 2 ;//******************************************:// ;****************************************** ;****************************************** ;***************************************************** ;*************************************************** ;*************************************************** ;//-------------------------------------------------- ;------------------------------------------------------------------------------------------------ UpdateDev(DriverFilePath){ global Sleep,100 WinActivate ,设备管理器 ControlFocus, SysTreeView321,设备管理器 Sleep,500 Send {Enter} Sleep,200 WinWait ,ahk_class #32770, , 30 Sleep,2000 ControlFocus, Button2, ahk_class #32770 ControlClick, Button2, ahk_class #32770 Sleep,200 WinWait ,硬件更新向导, , 30 Sleep,200 Control, Check, ,Button3, 硬件更新向导 Sleep,200 ControlFocus, Button5, 硬件更新向导 ControlClick, Button5, 硬件更新向导 Sleep,200 Control, Check, ,Button2, 硬件更新向导 Sleep,200 ControlFocus, Button7, 硬件更新向导 ControlClick, Button7, 硬件更新向导 Sleep,200 Control, Check, ,Button1, 硬件更新向导 Control, Uncheck, ,Button3, 硬件更新向导 Control, check, ,Button4, 硬件更新向导 Sleep,200 ControlFocus, Button5, 硬件更新向导 ControlClick, Button5, 硬件更新向导 Sleep,2000 WinWait ,浏览文件夹, , 300 Sleep,1000 ControlFocus, SysTreeView321,浏览文件夹 GetDirTreeHandles() ;get handles of Explorer and TreeView TV_Initialise(hwEx, hwTV) Sleep,1000 local myvar=0 UPDATEDEV_1: TV_SetPath(DriverFilePath) if ( ErrorLevel = 0 ) { myvar++ if( myvar<4){ Sleep,5000 Goto,UPDATEDEV_1 }else{ MsgBox,DriverFilePath-%DriverFilePath% MsgBox,ErrorLevel-%ErrorLevel% } }else{ } Sleep,5000 ControlFocus, SysTreeView321,浏览文件夹 Sleep,1000 ControlClick, Button2, 浏览文件夹 Sleep,1000 ControlFocus, Button12, 硬件更新向导 Sleep,500 ControlClick, Button12, 硬件更新向导 local myvar=0 UPDATEDEV_2: WinWait ,硬件安装,正在为此硬件安装的软件:,5 if ErrorLevel { } else{ WinWaitAndClikButton("硬件安装","Button1","正在为此硬件安装的软件:") } Sleep,3000 ;??????????????????????????????????????? WinWait ,硬件更新向导,完成硬件更新向导, 20 if ErrorLevel { myvar++ if( myvar<5){ Goto,UPDATEDEV_2 } } else{ Sleep,2000 ControlFocus, Button14, 硬件更新向导,完成硬件更新向导 Sleep,500 ControlClick, Button14, 硬件更新向导,完成硬件更新向导 } WinClose,ahk_class #32770 Sleep,2000 IfWinExist, ahk_class #32770 WinClose ; use the window found above else{ } } ;------------------------------------------------------------------------------------------------ WaitDevmgmt(){ ret := WinExist("设备管理器") if ( ret = 0 ){ Run,devmgmt.msc } WinWait ,设备管理器, , 30 } ;------------------------------------------------------------------------------------------------ DirTreeView_SetPath( Path ) { global GetDirTreeHandles() TV_Initialise(hwEx, hwTV) ret := TV_SetPath(Path) return ret } ;------------------------------------------------------------------------------------------------ DevMgmt_SetPath( Path ) { global GetTreeViewHandles() TV_Initialise(hwEx, hwTV) ret := TV_SetPath(Path) return ret } ; Get Explorer and its TreeView handle GetDirTreeHandles() { global ;get tree view handle hwEx := WinExist("浏览文件夹") hwTV := FindWindowExId(hwEx, "SHBrowseForFolder ShellNameSpace Control", 0) hwTV := FindWindowExID(hwTV, "SysTreeView32", 100) } ;------------------------------------------------------------------------------------------------ ; Get Explorer and its TreeView handle GetTreeViewHandles() { global ;get tree view handle hwEx := WinExist("设备管理器") hwTV := FindWindowExId(hwEx, "MDIClient", 0) hwTV := FindWindowExId(hwTV, "MMCChildFrm", 0) hwTV := FindWindowExId(hwTV, "MMCViewWindow", 0) hwTV := FindWindowExId(hwTV, "MMCOCXViewWindow", 0) hwTV := FindWindowExId(hwTV, "AtlAxWinEx", 0) hwTV := FindWindowExId(hwTV, "AfxOleControl42u", 0) hwTV := FindWindowExID(hwTV, "SysTreeView32", 0) } ;------------------------------------------------------------------------------------------------ ; Iterate through controls with the same class, find the one with ctrlID and return its handle ; Used for finding a specific control ; FindWindowExID(dlg, className, ctrlId) { local ctrl, id ctrl = 0 Loop { ctrl := DllCall("FindWindowEx", "uint", dlg, "uint", ctrl, "str", className, "uint", 0 ) if (ctrlId = "0") { return ctrl } if (ctrl != "0") { id := DllCall( "GetDlgCtrlID", "uint", ctrl ) if (id = ctrlId) return ctrl } else return 0 } } #include %A_ScriptDir%\RemoteBuf.ahk #include %A_ScriptDir%\RTV.ahk #include %A_ScriptDir%\Lvm_setItemState.ahk #include %A_ScriptDir%\BUTTON_LIB.ahk