zhenglei 发表于 2013-4-17 23:46:49

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

本帖最后由 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

       

haijie1223 发表于 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

fenhanxue 发表于 2013-4-20 11:33:09

把按钮2下面的代码,全部复制在按钮1代码后面就好了呀

小凯 发表于 2013-5-14 11:19:39

如果代码很多的话~~!直接模拟鼠标点击按钮2更便捷.....{:face (411):}

zzbtlc 发表于 2013-5-15 12:43:33

直接模拟鼠标点击按钮2更便捷

大叔 发表于 2013-5-15 22:30:30

把2的内容。 做成func 然后在一后面直接调用。
页: [1]
查看完整版本: 当我点击按钮1时。如何在执行完毕后自动执行按钮2中的内容?