读取GUI对话框输入的值,并执行相关命令。(已解决)
本帖最后由 vszy 于 2019-4-21 11:03 编辑#include <GuiDateTimePicker.au3>
$DIY = GUICreate("DIY", 167, 27)
$Date1_Input = GUICtrlGetHandle(GUICtrlCreateDate("",4, 4, 128, 19))
_GUICtrlDTP_SetFormat($Date1_Input, "yyyy" & "-" & "MM" & "-" & "dd" & " & " & "HH:mm")
GUISetState(@SW_SHOW)
$Go = GUICtrlCreateButton ('GO', 135, 4, 28, 19)
While 1
$msg = GUIGetMsg()
Switch $Msg
Case -3
Exit
Case $Go
RunWait(@ComSpec & ' /c ' & 'cmd.exe /c date yyyy-MM-dd', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'cmd.exe /c time HH:mm:00', '', @SW_HIDE)
EndSwitch
WEnd
想做个修改时间的小东东,但对GUICtrlRead等相关命令实在不熟,望有经验的朋友帮忙看看。先谢了!
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $go
;~ Run~~~~~~~
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
#include <GuiDateTimePicker.au3>
$DIY = GUICreate("DIY", 167, 27)
$Date1_Input = GUICtrlCreateDate("", 4, 4, 128, 19)
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date1_Input), "yyyy" & "-" & "MM" & "-" & "dd" & " & " & "HH:mm")
GUISetState(@SW_SHOW)
$Go = GUICtrlCreateButton('GO', 135, 4, 28, 19)
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $Go
$DATE = GUICtrlRead($Date1_Input)
$DATE = StringSplit($DATE, '&')
If IsArray($DATE) Then
RunWait(@ComSpec & ' /c ' & 'cmd.exe /c date ' & $DATE, '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'cmd.exe /c time ' & $DATE, '', @SW_HIDE)
EndIf
EndSwitch
WEnd
zhang_jf 发表于 2019-4-20 18:39
#include
$DIY = GUICreate("DIY", 167, 27)
$Date1_Input = GUICtrlCreateDate("", 4, 4, 128, 19)
多谢这位兄台,完美解决了。
页:
[1]