#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 330, 115, 192, 124)
$EXEToRun = GUICtrlCreateCombo("", 88, 56, 145, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "NOTEPAD.EXE|CALC.EXE|CMD.EXE|MSTSC.EXE|")
;也可以给这个控件加上事件GUICtrlSetOnEvent(-1,'RunCommand'),然后就不用点击“执行”按钮了
GUICtrlCreateButton("执行", 248, 56, 75, 25)
GUICtrlSetOnEvent(-1,'RunCommand')
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUISetOnEvent($GUI_EVENT_CLOSE,'QuitTool')
While 1
Sleep(100)
WEnd
Func QuitTool()
Exit
EndFunc
Func RunCommand()
$RunData=Run(GUICtrlRead($EXEToRun))
If Not $RunData = '' Then
Run($RunData)
EndIf
EndFunc
|