DaLiMan Posted February 21, 2005 Share Posted February 21, 2005 Hi, I like to have a HotButton for my script. It must work just like HotKeySet but I need it to be a button. Does anyone know a trick to this one? Link to comment Share on other sites More sharing options...
SlimShady Posted February 21, 2005 Share Posted February 21, 2005 See the help file for GUI examples. You can make a script that performs an action when you click on a button. Link to comment Share on other sites More sharing options...
DaLiMan Posted February 21, 2005 Author Share Posted February 21, 2005 See the help file for GUI examples.You can make a script that performs an action when you click on a button.<{POST_SNAPBACK}>Yes I know that, but what I want is press a button and then stop this process until another button is pressed in a single GUI which is always on top.GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_12 ; do stuff until button_13 is pressed Case $msg = $Button_13 ; Case Else ;;; EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
SlimShady Posted February 21, 2005 Share Posted February 21, 2005 Here's an example. #include <GUIConstants.au3> GUICreate('New GUI') $Button_12 = GUICtrlCreateButton("Button_12", 50, 10, 70, 25) $Button_13 = GUICtrlCreateButton("Button_13", 150, 10, 70, 25) GUISetState() Dim $x = 0 Dim $Busy = 0 While 1 Sleep(100) $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $msg = $Button_13 If $Busy Then $Busy = NOT $Busy $x = -1 Case $msg = $Button_12 OR $Busy If NOT $Busy Then $Busy = 1 ; do stuff until button_13 is pressed $x = $x + 1 ToolTip("$x = " & $x) Sleep(100) Case Else ;;; EndSelect WEnd Link to comment Share on other sites More sharing options...
DaLiMan Posted February 21, 2005 Author Share Posted February 21, 2005 Great thanx, I can rebuild from here..... Question: Must button13 come before the rest? BTW: It's not 100% proof is it? I found several times I needed to click Button13 twice or three times before it stopped. Link to comment Share on other sites More sharing options...
Helge Posted February 21, 2005 Share Posted February 21, 2005 Great thanx,I can rebuild from here..... Question:Must button13 come before the rest? BTW: It's not 100% proof is it?I found several times I needed to click Button13 twice or three times before it stopped.<{POST_SNAPBACK}>Try to remove the Sleep(100).That should do the job. Link to comment Share on other sites More sharing options...
DaLiMan Posted February 22, 2005 Author Share Posted February 22, 2005 Try to remove the Sleep(100).That should do the job.<{POST_SNAPBACK}>Yes !!!! Thanks guys for the help!!! Link to comment Share on other sites More sharing options...
quick_sliver007 Posted February 25, 2005 Share Posted February 25, 2005 Try this out. expandcollapse popup#include <GUIConstants.au3> GUICreate('New GUI') $Button_12 = GUICtrlCreateButton("Button_12", 50, 10, 70, 25) $Button_13 = GUICtrlCreateButton("Button_13", 150, 10, 70, 25) GUISetState() Dim $x = 0 Dim $Busy = 0 While 1 Sleep(100) $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $msg = $Button_13 If $Busy Then $Busy = NOT $Busy $x = -1 Case $msg = $Button_12 OR $Busy Call("_dountilbutton_13ispressed") $x = $x + 1 ToolTip("$x = " & $x) Sleep(100) Case Else ;;; EndSelect WEnd Func _dountilbutton_13ispressed() Do If NOT $Busy Then $Busy = 1 EndIf Until $msg = $button_13 EndFunc I hope this works. . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now