我有这样的代码:
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
GUICreate('GUI',550,500)
$CHECKBOXAA = GUICtrlCreateCheckbox("Restore point",20,20,100,20)
$CHECKBOXA2A = GUICtrlCreateCheckbox("Power config",20,40,100,20)
$CHECKBOXA3A = GUICtrlCreateCheckbox("Temp files",20,60,100,20)
$CHECKBOXA4A = GUICtrlCreateCheckbox("",20,80,100,20)
$CHECKBOXA5A = GUICtrlCreateCheckbox("",20,100,100,20)
$CHECKBOXA6A = GUICtrlCreateCheckbox("",20,120,100,20)
$CHECKBOXA7A = GUICtrlCreateCheckbox("",20,140,100,20)
$CHECKBOXA8A = GUICtrlCreateCheckbox("",20,160,100,20)
$CHECKBOXA9A = GUICtrlCreateCheckbox("",20,180,100,20)
$CHECKBOXA10A = GUICtrlCreateCheckbox("",20,200,100,20)
$CHECKBOXA11A = GUICtrlCreateCheckbox("",20,220,100,20)
$CHECKBOXA12A = GUICtrlCreateCheckbox("",20,240,100,20)
$CHECKBOXA13A = GUICtrlCreateCheckbox("",20,260,100,20)
$CHECKBOXA14A = GUICtrlCreateCheckbox("",20,280,100,20)
$CHECKBOXA15A = GUICtrlCreateCheckbox("",20,300,100,20)
$CHECKBOXA16A = GUICtrlCreateCheckbox("",20,320,100,20)
$CHECKBOXA17A = GUICtrlCreateCheckbox("",20,340,100,20)
$CHECKBOXA18A = GUICtrlCreateCheckbox("",20,360,100,20)
$CHECKBOXA19A = GUICtrlCreateCheckbox("",20,380,100,20)
$CHECKBOXA20A = GUICtrlCreateCheckbox("",20,400,100,20)
GUICtrlSetState ( $CHECKBOXAA, 1 )
GUICtrlSetState ( $CHECKBOXA2A, 1 )
GUICtrlSetState ( $CHECKBOXA3A, 1 )
GUICtrlSetState ( $CHECKBOXA4A, 1 )
GUICtrlSetState ( $CHECKBOXA5A, 1 )
GUICtrlSetState ( $CHECKBOXA6A, 1 )
GUICtrlSetState ( $CHECKBOXA7A, 1 )
GUICtrlSetState ( $CHECKBOXA8A, 1 )
GUICtrlSetState ( $CHECKBOXA9A, 1 )
GUICtrlSetState ( $CHECKBOXA10A, 1 )
GUICtrlSetState ( $CHECKBOXA11A, 1 )
GUICtrlSetState ( $CHECKBOXA12A, 1 )
GUICtrlSetState ( $CHECKBOXA13A, 1 )
GUICtrlSetState ( $CHECKBOXA14A, 1 )
GUICtrlSetState ( $CHECKBOXA15A, 1 )
GUICtrlSetState ( $CHECKBOXA16A, 1 )
GUICtrlSetState ( $CHECKBOXA17A, 1 )
GUICtrlSetState ( $CHECKBOXA18A, 1 )
GUICtrlSetState ( $CHECKBOXA19A, 1 )
GUICtrlSetState ( $CHECKBOXA20A, 1 )
GUICtrlCreateButton("More info", 120,20,50,20)
GUICtrlSetOnEvent(-1, "info")
GUISetState()
Func info()
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
Send("This will create a sysstem restore point. So you can recover your PC in the very unlikely chance something will go wrong.")
EndFunc
While 1
$MSGAA = GUIGetMsg()
If $MSGAA = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXAA) = 1 Then
FileDelete ( "FuncFuncAA.dll" )
$fileAA = FileOpen("FuncFuncAA.dll", 1)
FileWrite($fileAA, "1")
FileClose($fileAA)
Else
FileDelete ( "FuncFuncAA.dll" )
$fileAA = FileOpen("FuncFuncAA.dll", 1)
FileWrite($fileAA, "0")
FileClose($fileAA)
EndIf
$MSGA2A = GUIGetMsg()
If $MSGA2A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA2A) = 1 Then
FileDelete ( "FuncFuncA2A.dll" )
$fileA2A = FileOpen("FuncFuncA2A.dll", 1)
FileWrite($fileA2A, "1")
FileClose($fileA2A)
Else
FileDelete ( "FuncFuncA2A.dll" )
$fileA2A = FileOpen("FuncFuncA2A.dll", 1)
FileWrite($fileA2A, "0")
FileClose($fileA2A)
EndIf
$MSGA3A = GUIGetMsg()
If $MSGA3A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA3A) = 1 Then
FileDelete ( "FuncFuncA3A.dll" )
$fileA3A = FileOpen("FuncFuncA3A.dll", 1)
FileWrite($fileA3A, "1")
FileClose($fileA3A)
Else
FileDelete ( "FuncFuncA3A.dll" )
$fileA3A = FileOpen("FuncFuncA3A.dll", 1)
FileWrite($fileA3A, "0")
FileClose($fileA3A)
EndIf
$MSGA4A = GUIGetMsg()
If $MSGA4A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA4A) = 1 Then
FileDelete ( "FuncFuncA4A.dll" )
$fileA4A = FileOpen("FuncFuncA4A.dll", 1)
FileWrite($fileA4A, "1")
FileClose($fileA4A)
Else
FileDelete ( "FuncFuncA4A.dll" )
$fileA4A = FileOpen("FuncFuncA4A.dll", 1)
FileWrite($fileA4A, "0")
FileClose($fileA4A)
EndIf
$MSGA5A = GUIGetMsg()
If $MSGA5A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA5A) = 1 Then
FileDelete ( "FuncFuncA5A.dll" )
$fileA5A = FileOpen("FuncFuncA5A.dll", 1)
FileWrite($fileA5A, "1")
FileClose($fileA5A)
Else
FileDelete ( "FuncFuncA5A.dll" )
$fileA5A = FileOpen("FuncFuncA5A.dll", 1)
FileWrite($fileA5A, "0")
FileClose($fileA5A)
EndIf
$MSGA6A = GUIGetMsg()
If $MSGA6A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA6A) = 1 Then
FileDelete ( "FuncFuncA6A.dll" )
$fileA6A = FileOpen("FuncFuncA6A.dll", 1)
FileWrite($fileA6A, "1")
FileClose($fileA6A)
Else
FileDelete ( "FuncFuncA6A.dll" )
$fileA6A = FileOpen("FuncFuncA6A.dll", 1)
FileWrite($fileA6A, "0")
FileClose($fileA6A)
EndIf
$MSGA7A = GUIGetMsg()
If $MSGA7A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA7A) = 1 Then
FileDelete ( "FuncFuncA7A.dll" )
$fileA7A = FileOpen("FuncFuncA7A.dll", 1)
FileWrite($fileA7A, "1")
FileClose($fileA7A)
Else
FileDelete ( "FuncFuncA7A.dll" )
$fileA7A = FileOpen("FuncFuncA7A.dll", 1)
FileWrite($fileA7A, "0")
FileClose($fileA7A)
EndIf
$MSGA8A = GUIGetMsg()
If $MSGA8A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA8A) = 1 Then
FileDelete ( "FuncFuncA8A.dll" )
$fileA8A = FileOpen("FuncFuncA8A.dll", 1)
FileWrite($fileA8A, "1")
FileClose($fileA8A)
Else
FileDelete ( "FuncFuncA8A.dll" )
$fileA8A = FileOpen("FuncFuncA8A.dll", 1)
FileWrite($fileA8A, "0")
FileClose($fileA8A)
EndIf
$MSGA9A = GUIGetMsg()
If $MSGA9A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA9A) = 1 Then
FileDelete ( "FuncFuncA9A.dll" )
$fileA9A = FileOpen("FuncFuncA9A.dll", 1)
FileWrite($fileA9A, "1")
FileClose($fileA9A)
Else
FileDelete ( "FuncFuncA9A.dll" )
$fileA9A = FileOpen("FuncFuncA9A.dll", 1)
FileWrite($fileA9A, "0")
FileClose($fileA9A)
EndIf
$MSGA10A = GUIGetMsg()
If $MSGA10A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA10A) = 1 Then
FileDelete ( "FuncFuncA10A.dll" )
$fileA10A = FileOpen("FuncFuncA10A.dll", 1)
FileWrite($fileA10A, "1")
FileClose($fileA10A)
Else
FileDelete ( "FuncFuncA10A.dll" )
$fileA10A = FileOpen("FuncFuncA10A.dll", 1)
FileWrite($fileA10A, "0")
FileClose($fileA10A)
EndIf
$MSGA11A = GUIGetMsg()
If $MSGA11A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA11A) = 1 Then
FileDelete ( "FuncFuncA11A.dll" )
$fileA11A = FileOpen("FuncFuncA11A.dll", 1)
FileWrite($fileA11A, "1")
FileClose($fileA11A)
Else
FileDelete ( "FuncFuncA11A.dll" )
$fileA11A = FileOpen("FuncFuncA11A.dll", 1)
FileWrite($fileA11A, "0")
FileClose($fileA11A)
EndIf
$MSGA12A = GUIGetMsg()
If $MSGA12A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA12A) = 1 Then
FileDelete ( "FuncFuncA12A.dll" )
$fileA12A = FileOpen("FuncFuncA12A.dll", 1)
FileWrite($fileA12A, "1")
FileClose($fileA12A)
Else
FileDelete ( "FuncFuncA12A.dll" )
$fileA12A = FileOpen("FuncFuncA12A.dll", 1)
FileWrite($fileA12A, "0")
FileClose($fileA12A)
EndIf
$MSGA13A = GUIGetMsg()
If $MSGA13A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA13A) = 1 Then
FileDelete ( "FuncFuncA13A.dll" )
$fileA13A = FileOpen("FuncFuncA13A.dll", 1)
FileWrite($fileA13A, "1")
FileClose($fileA13A)
Else
FileDelete ( "FuncFuncA13A.dll" )
$fileA13A = FileOpen("FuncFuncA13A.dll", 1)
FileWrite($fileA13A, "0")
FileClose($fileA13A)
EndIf
$MSGA14A = GUIGetMsg()
If $MSGA14A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA14A) = 1 Then
FileDelete ( "FuncFuncA14A.dll" )
$fileA14A = FileOpen("FuncFuncA14A.dll", 1)
FileWrite($fileA14A, "1")
FileClose($fileA14A)
Else
FileDelete ( "FuncFuncA14A.dll" )
$fileA14A = FileOpen("FuncFuncA14A.dll", 1)
FileWrite($fileA14A, "0")
FileClose($fileA14A)
EndIf
$MSGA15A = GUIGetMsg()
If $MSGA15A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA15A) = 1 Then
FileDelete ( "FuncFuncA15A.dll" )
$fileA15A = FileOpen("FuncFuncA15A.dll", 1)
FileWrite($fileA15A, "1")
FileClose($fileA15A)
Else
FileDelete ( "FuncFuncA15A.dll" )
$fileA15A = FileOpen("FuncFuncA15A.dll", 1)
FileWrite($fileA15A, "0")
FileClose($fileA15A)
EndIf
$MSGA16A = GUIGetMsg()
If $MSGA16A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA16A) = 1 Then
FileDelete ( "FuncFuncA16A.dll" )
$fileA16A = FileOpen("FuncFuncA16A.dll", 1)
FileWrite($fileA16A, "1")
FileClose($fileA16A)
Else
FileDelete ( "FuncFuncA16A.dll" )
$fileA16A = FileOpen("FuncFuncA16A.dll", 1)
FileWrite($fileA16A, "0")
FileClose($fileA16A)
EndIf
$MSGA17A = GUIGetMsg()
If $MSGA17A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA17A) = 1 Then
FileDelete ( "FuncFuncA17A.dll" )
$fileA17A = FileOpen("FuncFuncA17A.dll", 1)
FileWrite($fileA17A, "1")
FileClose($fileA17A)
Else
FileDelete ( "FuncFuncA17A.dll" )
$fileA17A = FileOpen("FuncFuncA17A.dll", 1)
FileWrite($fileA17A, "0")
FileClose($fileA17A)
EndIf
$MSGA18A = GUIGetMsg()
If $MSGA18A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA18A) = 1 Then
FileDelete ( "FuncFuncA18A.dll" )
$fileA18A = FileOpen("FuncFuncA18A.dll", 1)
FileWrite($fileA18A, "1")
FileClose($fileA18A)
Else
FileDelete ( "FuncFuncA18A.dll" )
$fileA18A = FileOpen("FuncFuncA18A.dll", 1)
FileWrite($fileA18A, "0")
FileClose($fileA18A)
EndIf
$MSGA19A = GUIGetMsg()
If $MSGA19A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA19A) = 1 Then
FileDelete ( "FuncFuncA19A.dll" )
$fileA19A = FileOpen("FuncFuncA19A.dll", 1)
FileWrite($fileA19A, "1")
FileClose($fileA19A)
Else
FileDelete ( "FuncFuncA19A.dll" )
$fileA19A = FileOpen("FuncFuncA19A.dll", 1)
FileWrite($fileA19A, "0")
FileClose($fileA19A)
EndIf
$MSGA20A = GUIGetMsg()
If $MSGA20A = -3 Then
Exit
EndIf
If GUICtrlRead($CHECKBOXA20A) = 1 Then
FileDelete ( "FuncFuncA20A.dll" )
$fileA20A = FileOpen("FuncFuncA20A.dll", 1)
FileWrite($fileA20A, "1")
FileClose($fileA20A)
Else
FileDelete ( "FuncFuncA20A.dll" )
$fileA20A = FileOpen("FuncFuncA20A.dll", 1)
FileWrite($fileA20A, "0")
FileClose($fileA20A)
EndIf
Sleep(1000)
WEnd
它使一个按钮说More info
,但它似乎没有运行的功能。有谁知道我做错了什么吗?
问题出现在这里:
GUICtrlCreateButton("More info", 120,20,50,20)
GUICtrlSetOnEvent(-1, "info")
GUISetState()
Func info()
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
Send("This will create a sysstem restore point. So you can recover your PC in the very unlikely chance something will go wrong.")
EndFunc
为了使用OnEvent GUI功能,您需要设置如下:
Opt("GUIOnEventMode", 1)