Sign in to follow this  
Followers 0
retaly

i need help with gui(stop/start with checkbox)

6 posts in this topic

Hi, i have one small problem

i did a gui, where i can switch the values, and it is work so good. but my problem is:

i did a checkbox, checkbox func is repeat/no repeat scripts..

how can i do how when i click to chekcbox and to start button( and now running the script with repeat), after that if i click to

checkbox again(pipe is off), the script is stopping with repeat.(sry for bad english)

plz help me!!! :graduated:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 197, 201, 513, 292)
$gomb1 = GUICtrlCreateInput("1", 72, 32, 97, 21, $GUI_SS_DEFAULT_INPUT)
$btnStart = GUICtrlCreateButton("Start", 56, 160, 75, 25)
GUICtrlCreateLabel("Skill Gomb:", 16, 32, 57, 17)
GUICtrlCreateLabel("sleep:", 32, 56, 40, 17)
$szunet1 = GUICtrlCreateInput("1000", 72, 56, 97, 21, $GUI_SS_DEFAULT_INPUT)
GUICtrlCreateLabel("Skill Gomb:", 16, 80, 57, 17)
GUICtrlCreateLabel("sleep:", 32, 104, 40, 17)
$szunet2 = GUICtrlCreateInput("1000", 72, 104, 97, 21, $GUI_SS_DEFAULT_INPUT)
$gomb2 = GUICtrlCreateInput("2", 72, 80, 97, 21, $GUI_SS_DEFAULT_INPUT)
$ismetles = GUICtrlCreateCheckbox("Repeat", 72, 136, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $gomb1
  Case $btnStart
   $string = GUICtrlRead($gomb1)
   $string1 = GUICtrlRead($szunet1)
   $string2 = GUICtrlRead($gomb2)
   $string3 = GUICtrlRead($szunet2)
   $ism = GUICtrlRead($ismetles)
   If ProcessExists($ism) Then
   Send($string & @LF)
   Sleep($string1 & @LF)
   Send($string2 & @LF)
   Sleep($string3 & @LF)
   $nMsg = GUIGetMsg()
     Switch $nMsg
   Case $GUI_EVENT_CLOSE
   Exit
  EndSwitch
 
Else
  While 1
     Send($string & @LF)
   Sleep($string1 & @LF)
   Send($string2 & @LF)
   Sleep($string3 & @LF)
   $nMsg = GUIGetMsg()
     Switch $nMsg
   Case $GUI_EVENT_CLOSE
   Exit
  EndSwitch
WEnd
EndIf

  Case $szunet1
  Case $szunet2
  Case $gomb2
EndSwitch
WEnd

Share this post


Link to post
Share on other sites



Create a Stop button and put a script like below in the loop?

Case $StopButton
Exit

Challenge accepted!

Share this post


Link to post
Share on other sites

ah not, i wanna just pausing the script runing when pick up the pipe from box, and the script is started again when i click again to box

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Go through the steps 1 by 1 with me of what your trying to do again cause im not understanding. You have muiltiple GUIGetMsg() loops inside other GUIGetMsg() loops which is doesnt make sense. If you press the startbut and the process does not exist you go into a endless loop that only waits for you to close it.

edit:

This part. What are you trying to do here?

Case $btnStart
   $string = GUICtrlRead($gomb1)
   $string1 = GUICtrlRead($szunet1)
   $string2 = GUICtrlRead($gomb2)
   $string3 = GUICtrlRead($szunet2)
   $ism = GUICtrlRead($ismetles)
   If ProcessExists($ism) Then
    Send($string & @LF)
    Sleep($string1 & @LF)
    Send($string2 & @LF)
    Sleep($string3 & @LF)
    $nMsg = GUIGetMsg()
    Switch $nMsg
     Case $GUI_EVENT_CLOSE
      Exit
    EndSwitch
   Else
    While 1
     Send($string & @LF)
     Sleep($string1 & @LF)
     Send($string2 & @LF)
     Sleep($string3 & @LF)
     $nMsg = GUIGetMsg()
     Switch $nMsg
      Case $GUI_EVENT_CLOSE
       Exit
     EndSwitch
    WEnd
   EndIf
Edited by Beege

Share this post


Link to post
Share on other sites

ah nothing... i fixed my problem ˘˘˘so it is work

Share this post


Link to post
Share on other sites

ok but your using GUIGetMsg() wrong. If you need to sleep() in your main loop between sending strings, I would look into using OnEvent mode. Using sleep() in a GUIGetMsg() loop will cause your gui controls to not respond.. :graduated:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0