找回密码
 加入
搜索
查看: 3102|回复: 5

[AU3基础] 新人学组合列表用法,帮看看这段代码错在哪?(已解决)

  [复制链接]
发表于 2013-11-4 15:58:40 | 显示全部楼层 |阅读模式
本帖最后由 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
求高人指点,谢谢(只是学用用法,所以代码没写多少——)
发表于 2013-11-4 17:32:54 | 显示全部楼层
本帖最后由 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
发表于 2013-11-4 18:03:31 | 显示全部楼层
接2楼,继续简化:
Case $Button1
                Local $txt_Path = @DesktopDir & "" & StringRight(GUICtrlRead($Combo1), 2) & ".txt"
                ShellExecute($txt_Path)
 楼主| 发表于 2013-11-4 18:51:32 | 显示全部楼层
回复 2# haijie1223
非常感谢,向您致敬,测试好用
发表于 2013-11-4 19:15:04 | 显示全部楼层
为什么论坛没钱
发表于 2013-12-23 15:04:40 | 显示全部楼层
这个学习了 正好我需要
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-11 04:30 , Processed in 0.086076 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表