当我点击按钮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
直接贴在后面就行了~
#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
把按钮2下面的代码,全部复制在按钮1代码后面就好了呀 如果代码很多的话~~!直接模拟鼠标点击按钮2更便捷.....{:face (411):} 直接模拟鼠标点击按钮2更便捷 把2的内容。 做成func 然后在一后面直接调用。
页:
[1]