新人学组合列表用法,帮看看这段代码错在哪?(已解决)
本帖最后由 xhxlt0820 于 2013-11-4 18:59 编辑#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 144, 120, 113, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "运行一班|运行二班|运行三班", "运行一班")
$Button1 = GUICtrlCreateButton("登陆", 264, 120, 73, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
Select
Case GUICtrlRead($Combo1) = "运行一班"
$nMsg = $Button1
Run(@DesktopDir &"\一班.txt")
Case GUICtrlRead($Combo1) = "运行二班"
$nMsg = $Button1
Run(@DesktopDir &"\二班.txt")
EndSelect
WEnd
求高人指点,谢谢(只是学用用法,所以代码没写多少——) 本帖最后由 haijie1223 于 2013-11-4 17:34 编辑
这样行不~While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Combo1) = "运行一班" Then ShellExecute(@DesktopDir & "\一班.txt")
If GUICtrlRead($Combo1) = "运行二班" Then ShellExecute(@DesktopDir & "\二班.txt")
If GUICtrlRead($Combo1) = "运行三班" Then ShellExecute(@DesktopDir & "\三班.txt")
EndSwitch
WEnd 接2楼,继续简化:Case $Button1
Local $txt_Path = @DesktopDir & "\" & StringRight(GUICtrlRead($Combo1), 2) & ".txt"
ShellExecute($txt_Path) 回复 2# haijie1223
非常感谢,向您致敬,测试好用 为什么论坛没钱 这个学习了 正好我需要
页:
[1]