Jump to content
Sign in to follow this  
spkiller

a button that doesnt work

Recommended Posts

spkiller

in my script i try to end the loop with a endloop when you press the button stop but when you press it the script continues and never stops

here is the code

$Form1 = GUICreate("App Automator", 751, 447)
$Tab = GUICtrlCreateTab(8, 8, 737, 425)
;~ ------------------------------------------------------------------------------------
$tab1 = GUICtrlCreateTabItem("Bot 1")
$browser1 = _IECreateEmbedded()
$GUIActiveX1 = GUICtrlCreateObj($browser1, 300, 150, 430, 250)
$URL1 = GUICtrlCreateInput("", 32, 104, 481, 21)
$UrlLabel1 = GUICtrlCreateLabel("Url", 32, 80, 17, 17)
$PointsLabel1 = GUICtrlCreateLabel("Points Needed per action?", 16, 136, 130, 17)
$pointsin1 = GUICtrlCreateInput("", 32, 160, 89, 21)
$TimeLabel1 = GUICtrlCreateLabel("Time needed to regain point in miliseconds?", 160, 136, 142, 17)
$timein1 = GUICtrlCreateInput("", 176, 160, 105, 21)
$start1 = GUICtrlCreateButton("Start", 104, 288, 97, 33, $WS_GROUP)
$stop1 = GUICtrlCreateButton("stop", 104, 325, 97, 33, $WS_GROUP)
$points1 = GUICtrlRead($pointsin1)
$times1 = GUICtrlCreateInput("", 32, 220, 89, 21)
$Timesx1 = GUICtrlCreateLabel("Times to do it? -1 = inf", 32, 200, 142, 17)
GUISetState(@SW_SHOW)


While 1
    $time1 = GUICtrlRead($times1)
    $math1 = GUICtrlRead($pointsin1) * GUICtrlRead($time1)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $stop1
            ExitLoop
        Case $start1
            If GUICtrlRead($URL1) <> "" Then
                If GUICtrlRead($pointsin1) <> "" Then
                    If GUICtrlRead($timein1) <> "" Then
                        _IENavigate($browser1, GUICtrlRead($URL1), 1)
                        Sleep($math1)
                        $time1 = $time1 - 1
                        Do
                            _IENavigate($browser1, GUICtrlRead($URL1), 1)
                            Sleep($math1)
                            $time1 = $time1 - 1
                            If $time1 = 0 Then ExitLoop
                        Until $time1 = 0
                    Else
                        MsgBox(0, "Your missing stuff", "please put the time it takes to regain a point")
                    EndIf
                Else
                    MsgBox(0, "Your missing stuff", "Please put the amount of points")
                EndIf
            Else
                MsgBox(0, "Your missing stuff", "please put the url of the action you wish to do")
            EndIf
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Yashied

Why have you not posted the ready to run script (I mean #Include <...>)?

:D

Actually, in your code, I do not like much ... No, I do not like the entire. Everything was done "very strange". Here are just a few changes relating to the topic.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
;       Case $stop1
;           ExitLoop
        Case $start1
            $time1 = GUICtrlRead($times1)
            $math1 = GUICtrlRead($pointsin1) * $time1
            If GUICtrlRead($URL1) <> "" Then
                If GUICtrlRead($pointsin1) <> "" Then
                    If GUICtrlRead($timein1) <> "" Then
;                       _IENavigate($browser1, GUICtrlRead($URL1), 1)
;                       Sleep($math1)
;                       $time1 = $time1 - 1
                        $Url = GUICtrlRead($URL1)
                        $Timer = TimerInit()
                        $Update = True
                        Do
                            Switch $nMsg
                                Case $GUI_EVENT_CLOSE
                                    Exit
                                Case $stop1
                                    ExitLoop
                            EndSwitch
                            If $Update Then
                                _IENavigate($browser1, $Url, 1)
                                $time1 = $time1 - 1
                                $Update = False
                            EndIf
                            If (TimerDiff($Timer) > $math1) Then
                                $Timer = TimerInit()
                                $Update = True
                            EndIf
                        Until $time1 = 0
                    Else
                        MsgBox(0, "Your missing stuff", "please put the time it takes to regain a point")
                    EndIf
                Else
                    MsgBox(0, "Your missing stuff", "Please put the amount of points")
                EndIf
            Else
                MsgBox(0, "Your missing stuff", "please put the url of the action you wish to do")
            EndIf
    EndSwitch
WEnd

Indeed, read the Help file, there is an excellent example for all functions. You do not need to invent the wheel.

:D

Share this post


Link to post
Share on other sites
spkiller

Why have you not posted the ready to run script (I mean #Include <...>)?

:D

Actually, in your code, I do not like much ... No, I do not like the entire. Everything was done "very strange". Here are just a few changes relating to the topic.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
;       Case $stop1
;           ExitLoop
        Case $start1
            $time1 = GUICtrlRead($times1)
            $math1 = GUICtrlRead($pointsin1) * $time1
            If GUICtrlRead($URL1) <> "" Then
                If GUICtrlRead($pointsin1) <> "" Then
                    If GUICtrlRead($timein1) <> "" Then
;                       _IENavigate($browser1, GUICtrlRead($URL1), 1)
;                       Sleep($math1)
;                       $time1 = $time1 - 1
                        $Url = GUICtrlRead($URL1)
                        $Timer = TimerInit()
                        $Update = True
                        Do
                            Switch $nMsg
                                Case $GUI_EVENT_CLOSE
                                    Exit
                                Case $stop1
                                    ExitLoop
                            EndSwitch
                            If $Update Then
                                _IENavigate($browser1, $Url, 1)
                                $time1 = $time1 - 1
                                $Update = False
                            EndIf
                            If (TimerDiff($Timer) > $math1) Then
                                $Timer = TimerInit()
                                $Update = True
                            EndIf
                        Until $time1 = 0
                    Else
                        MsgBox(0, "Your missing stuff", "please put the time it takes to regain a point")
                    EndIf
                Else
                    MsgBox(0, "Your missing stuff", "Please put the amount of points")
                EndIf
            Else
                MsgBox(0, "Your missing stuff", "please put the url of the action you wish to do")
            EndIf
    EndSwitch
WEnd

Indeed, read the Help file, there is an excellent example for all functions. You do not need to invent the wheel.

:D

thnx lol i started to code a few days ago im used to another type of language if anyone plz help me i need a mentor XD Edited by spkiller

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  

×