#include <DateTimeConstants.au3>
#include <Array.au3>
GUICreate("Form1", 400, 300)
Global $CheckOrder[0]
$Checkbox1 = GUICtrlCreateCheckbox("时间节点 - 1", 40, 30, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("时间节点 - 2", 40, 60, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("时间节点 - 3", 40, 90, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("时间节点 - 4", 40, 120, 97, 17)
$time1 = GUICtrlCreateDate('2020/11/24', 200, 30, 180, 17)
$time2 = GUICtrlCreateDate('2020/11/24', 200, 60, 180, 17)
$time3 = GUICtrlCreateDate('2020/11/24', 200, 90, 180, 17)
$time4 = GUICtrlCreateDate('2020/11/24', 200, 120, 180, 17)
$style = "yyyy/MM/dd HH:mm:ss"
$DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW,来自于函数DateTimeConstants.au3
GUICtrlSendMsg($time1, $DTM_SETFORMAT_, 0, $style)
GUICtrlSendMsg($time2, $DTM_SETFORMAT_, 0, $style)
GUICtrlSendMsg($time3, $DTM_SETFORMAT_, 0, $style)
GUICtrlSendMsg($time4, $DTM_SETFORMAT_, 0, $style)
$b = GUICtrlCreateButton('Start', 130, 200, 150, 25)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Checkbox1 To $Checkbox4
If GUICtrlRead($nMsg) = 1 Then
_ArrayAdd($CheckOrder, $nMsg)
Else
SetError(0)
$aFindOrder = _ArrayFindAll($CheckOrder, $nMsg)
If IsArray($aFindOrder) Then
_ArrayReverse($aFindOrder)
For $a = 0 To UBound($aFindOrder) - 1
_ArrayDelete($CheckOrder, $aFindOrder[$a])
Next
Else
ConsoleWrite("@error:" & @error & @CRLF)
EndIf
EndIf
Case $b
If IsArray($CheckOrder) Then
For $i = 0 To UBound($CheckOrder) - 1
If GUICtrlRead($CheckOrder[$i]) = 1 Then Call('_Go', $CheckOrder[$i])
Next
EndIf
EndSwitch
WEnd
Func _Go($Var)
Switch $Var
Case $Checkbox1
MsgBox(0, '', '执行复选框 ' & GUICtrlRead($Var, 1) & ' 的任务')
Case $Checkbox2
MsgBox(0, '', '执行复选框 ' & GUICtrlRead($Var, 1) & ' 的任务')
Case $Checkbox3
MsgBox(0, '', '执行复选框 ' & GUICtrlRead($Var, 1) & ' 的任务')
Case $Checkbox4
MsgBox(0, '', '执行复选框 ' & GUICtrlRead($Var, 1) & ' 的任务')
EndSwitch
EndFunc ;==>_Go