找回密码
 加入
搜索
查看: 3965|回复: 6

[GUI管理] 当我点击按钮1时。如何在执行完毕后自动执行按钮2中的内容?

  [复制链接]
发表于 2013-4-17 23:46:49 | 显示全部楼层 |阅读模式
本帖最后由 zhenglei 于 2013-4-17 23:58 编辑

代码如下:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Button1 = GUICtrlCreateButton("Button1", 88, 40, 89, 57)
$Button2 = GUICtrlCreateButton("Button2", 264, 56, 129, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        cs()

                  ContinueCase $Button2
                Case $Button2
                        MsgBox(0,0,"我是按钮2")
                        ;.....
                                                ;.....
                                                                        ;.....
                                                                        cs2()
        EndSwitch
WEnd

Func cs()
        ;;;;;;;;这里我执行了好多的命令 ,然后在这里引用 $Button2 的执行命令!
        ;;;...
                ;;;...
                ;;;...
                ;;;...
                ;;;...
                ;;;...
                ;;;...
                ;;;...
                ;;;...
$a=1
If $a=1 Then
For $i=1 To 10
;;;执行 $Button2 中的内容!
        Next
        EndIf
        EndFunc

        
发表于 2013-4-18 09:16:14 | 显示全部楼层
直接贴在后面就行了~
发表于 2013-4-18 19:49:10 | 显示全部楼层

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Button1 = GUICtrlCreateButton("Button1", 88, 40, 89, 57)
$Button2 = GUICtrlCreateButton("Button2", 264, 56, 129, 57)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        cs()
                Case $Button2
                        MsgBox(0, 0, "我是按钮2")
                        cs2()
        EndSwitch
WEnd

Func cs()
        ;;;;;;;;这里我执行了好多的命令 ,然后在这里引用 $Button2 的执行命令!
        ;;;...
        $a = 1
        If $a = 1 Then
                For $i = 1 To 10
                        ;;;执行 $Button2 中的内容!
                        cs2()
                Next
        EndIf
EndFunc   ;==>cs
发表于 2013-4-20 11:33:09 | 显示全部楼层
把按钮2下面的代码,全部复制在按钮1代码后面就好了呀
发表于 2013-5-14 11:19:39 | 显示全部楼层
如果代码很多的话~~!直接模拟鼠标点击按钮2更便捷.....
发表于 2013-5-15 12:43:33 | 显示全部楼层
直接模拟鼠标点击按钮2更便捷

评分

参与人数 1贡献 -1 收起 理由
afan -1

查看全部评分

发表于 2013-5-15 22:30:30 | 显示全部楼层
把2的内容。 做成func 然后在一后面直接调用。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-5 06:00 , Processed in 0.088261 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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