本帖最後由 rictirse 於 2012-11-5 23:40 編輯
第四課教 模組化的 安裝
非常方便修改與維護 一個自動安裝大概只需要4~5分鐘就可以完成了!!
看影片教學最簡單惹!!!
[code=autoit]#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: Dang Wang
Script Function: Install DEMO
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#NoTrayIcon
AutoItSetOption ( "WinTitleMatchMode", 4)
GUISetIcon (@ScriptDir&"/NewDang.ico")
Dim Const $FileName= ""
Dim Const $FormName = ""
;------- (1 Click;2 Check;3 UnCheck;4 SetText )-------
;------- (TitleName, Text, ControlID , Flag↑, SetText)-------
Dim $Text[14][5] = [ [ $FormName, "Enter Text", "ButtonName", 1, ""], _
[ $FormName, "Enter Text", "ButtonName", 1, ""], _
[ $FormName, "Enter Text", "ButtonName", 1, ""] ]
$begin = TimerInit()
While 1
For $i = 0 To UBound ( $Text, 1)-1
Select
Case WinExists ( $Text[$i][0], $Text[$i][1])
If $Text[$i][3] = 1 Then
ControlClick ( $Text[$i][0], $Text[$i][1], $Text[$i][2])
ElseIf $Text[$i][3] = 2 Then
ControlCommand ( $Text[$i][0], $Text[$i][1], $Text[$i][2], "Check", "")
ElseIf $Text[$i][3] = 3 Then
ControlCommand ( $Text[$i][0], $Text[$i][1], $Text[$i][2], "UnCheck", "")
ElseIf $Text[$i][3] = 4 Then
ControlSetText ( $Text[$i][0], $Text[$i][1], $Text[$i][2], $Text[$i][4])
EndIf
If $i = (UBound ( $Text, 1)-1) Then ExitLoop(2)
EndSelect
Next
WEnd
_Patch()
$dif = TimerDiff ($begin)
MsgBox ( 0, "安裝完成", StringFormat ( "總安裝時間:%s秒", $dif/1000))[/code] |