Jump to content
Maurizio

Start button problem

Recommended Posts

Hi Foro
Using Koda to create this interface, I noticed that the start key when clicked, starts the program, but at each step of the Wile loop, it must be clicked again. How can this situation be remedied?
Thank you

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Group1 = GUICtrlCreateGroup("Group1", 40, 48, 537, 97)
$Input1 = GUICtrlCreateInput("Input1", 64, 72, 89, 21)
$Input2 = GUICtrlCreateInput("Input2", 216, 72, 105, 21)
$Input3 = GUICtrlCreateInput("Input3", 392, 72, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Avvia = GUICtrlCreateButton("Avvia", 232, 224, 137, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
                  While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Avvia
            Sleep(5000)
            MouseClick("left", 559, 502, 1)
            Sleep(5000)
            MouseClick("left", 717, 262, 1)
            $value = GUICtrlRead($Input1)
            Send($value, "")
            Sleep(2000)
            MouseClick("left", 878, 263, 1)
            $value1 = GUICtrlRead($Input2)
            Send($value1, "")
            Sleep(2000)
            MouseClick("left",939, 263, 1)
            sleep(3000)
       Case $Input3
            $Input = GUICtrlRead($Input3)
             If $Input > 0 And $Input <= 15 Then
                Switch $Input3
                   Case 1

    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites

It can be done like this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Group1 = GUICtrlCreateGroup("Group1", 40, 48, 537, 97)
$Input1 = GUICtrlCreateInput("Input1", 64, 72, 89, 21)
$Input2 = GUICtrlCreateInput("Input2", 216, 72, 105, 21)
$Input3 = GUICtrlCreateInput("Input3", 392, 72, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Avvia = GUICtrlCreateButton("Avvia", 232, 224, 137, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $looptest = -1

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Avvia
            $looptest = -$looptest
        Case $Input3
            $Input = GUICtrlRead($Input3)
            If $Input > 0 And $Input <= 15 Then
                Switch $Input3
                    Case 1
                EndSwitch
            EndIf
    EndSwitch
    If $looptest = 1 Then
        StartingLoop()
    EndIf

WEnd

Func StartingLoop()
    Sleep(5000)
    MouseClick("left", 559, 502, 1)
    Sleep(5000)
    MouseClick("left", 717, 262, 1)
    $value = GUICtrlRead($Input1)
    Send($value, "")
    Sleep(2000)
    MouseClick("left", 878, 263, 1)
    $value1 = GUICtrlRead($Input2)
    Send($value1, "")
    Sleep(2000)
    MouseClick("left", 939, 263, 1)
    Sleep(3000)
EndFunc   ;==>StartingLoop

but, the button to stop it will work only when the StartingLoop has been done, and if i have counted right, it means every 18 seconds it would be useable.


~Dan~ :Emu.Zone now with Desktop Pets / DeskMates - (Bugfixed UniScrMate 4.1)

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...