找回密码
 加入
搜索
查看: 5419|回复: 8

[AU3基础] [已解决]au3 变量

  [复制链接]
发表于 2014-12-2 14:37:54 | 显示全部楼层 |阅读模式
本帖最后由 mshuking 于 2014-12-11 14:32 编辑
$Radio1 = GUICtrlCreateRadio("测试1", 16, 72, 91, 33, 0)
$Radio2 = GUICtrlCreateRadio("测试2", 128, 72, 99, 33, 0)
$Radio3 = GUICtrlCreateRadio("测试3", 248, 72, 99, 33, 0)
$Radio4 = GUICtrlCreateRadio("测试4", 368, 72, 99, 33, 0)
$Radio5 = GUICtrlCreateRadio("测试5", 488, 72, 99, 33, 0)
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
$Radio48 = GUICtrlCreateRadio("测试48", 848, 304, 91, 33, 0)
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
$Button1 = GUICtrlCreateButton("测试", 816, 728, 131, 73, 0)
$Radio = $Radio1.。。。。。。。。。。。$Radio48                 注 :这里怎么写
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
        Case $Button1
                       If GUICtrlRead(这时调用$Radio才好使) = $GUI_CHECKED Then run("", "", @sw_hide)
$Radio = $Radio1.。。。。。。。。。。。$Radio48                 注 :这里怎么写
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
        Case $Button1
                       If GUICtrlRead(这时调用$Radio才好使) = $GUI_CHECKED Then run("", "", @sw_hide)
 楼主| 发表于 2014-12-2 14:40:27 | 显示全部楼层
Case $Button1
                       If GUICtrlRead($Radio1) = $GUI_CHECKED Then run("", "", @sw_hide)
                       If GUICtrlRead($Radio2) = $GUI_CHECKED Then run("", "", @sw_hide)
                       。
                       If GUICtrlRead($Radio48) = $GUI_CHECKED Then run("", "", @sw_hide)
这样要写好长


         $Radio = $Radio1.。。。。。。。。。。。$Radio48
        Case $Button1
                    If GUICtrlRead($Radio) = $GUI_CHECKED Then run("", "", @sw_hide)
发表于 2014-12-2 17:07:25 | 显示全部楼层
如果运行的东西不一样 只能 一个一个的写吧
发表于 2014-12-2 17:57:37 | 显示全部楼层
回复 1# mshuking


用数组存放要运行的命令,就可以大大的简化代码.
Local $radio = 0
Local $exec[48] = ['c:\1.exe', 'd:\2.exe'] ;........
;....
$Radio1 = GUICtrlCreateRadio("测试1", 16, 72, 91, 33, 0)
GUICtrlSetState(-1, $gui_checked)
$Radio2 = GUICtrlCreateRadio("测试2", 128, 72, 99, 33, 0)
;.....
$Radio48 = GUICtrlCreateRadio("测试48", 848, 304, 91, 33, 0)
; .....
$Button1 = GUICtrlCreateButton("测试", 816, 728, 131, 73, 0)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg                
                Case $radio1 To $radio48
                       $radio = $nMsg - $radio1
                           ; 点击 $Radio1 $radio = 0  <<==>> $exec[0]
                           ; 点击 $Radio2 $radio = 1  <<==>> $exec[1]
                           ;...
                           ; 点击 $Radio48 $radio = 47 <<==>> $exec[47]
                Case $button1
                           Run($exec[$radio], '', @SW_HIDE)
    EndSwitch
WEnd
发表于 2014-12-3 18:50:52 | 显示全部楼层
学习了,数组法不错
 楼主| 发表于 2014-12-4 13:17:15 | 显示全部楼层
谢谢。。。。。。。
 楼主| 发表于 2014-12-4 13:17:30 | 显示全部楼层
Case $radio1 To $radio48

                       $radio = $nMsg - $radio1

                           ; 点击 $Radio1 $radio = 0  <<==>> $exec[0]

                           ; 点击 $Radio2 $radio = 1  <<==>> $exec[1]

                           ;...

                           ; 点击 $Radio48 $radio = 47 <<==>> $exec[47]

                Case $button1

                           Run($exec[$radio], '', @SW_HIDE)
发表于 2014-12-5 08:38:07 | 显示全部楼层
前来学习。。。。。。。。。。。。。。
发表于 2014-12-5 11:41:56 | 显示全部楼层
路过学习看看
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 10:15 , Processed in 0.088202 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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