Sign in to follow this  
Followers 0
Webcreation

GUI with a button..

13 posts in this topic

So i made a GUI, and i said case $button1 ,exit. But instead of exiting the GUI it doesnt respond at all.. Please help! thanks in advance!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("THIS IS THE INSTRUCTION SCREEN", 748, 539, 299, 102)
$Pic1 = GUICtrlCreatePic("C:\Users\Sabbih\Desktop\website\Setupscreen2.jpg", -17, 0, 764, 556)
$Button1 = GUICtrlCreateButton("Start VanityBot!", 271, 432, 193, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            Exit
    EndSwitch
WEnd

Also, i have a picture inserted into this GUI.

So if i give this script in .exe form to another person by download. Will he see the same image or not? THANKS!

Share this post


Link to post
Share on other sites



Sorry for the dubble post! How can i make it so that, when the button is pressed it will continu to the main part of the script? 

Much love & appriciation!

Share this post


Link to post
Share on other sites

insert

GUICtrlSetState(-1, $GUI_DISABLE)

right after

 $Pic1 = GUICtrlCreatePic("C:UsersSabbihDesktopwebsiteSetupscreen2.jpg", -17, 0, 764, 556)


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

while 1
    Call("petswap")
    Call("round1")
    Call("round1")
    Call("round1")

    ;last middle enter rounds after this
    Call("round1")
    Call("round1")
    Call("clearInv")

Call("round1")
Call("round1")
Call("petswap2")

    Call("round1")
    Call("round1")
    Call("round1")

    ;last middle enter rounds after this


    Call("clearInv")


    ;3rd petswap


    Call("round1")
    Call("round1")
    Call("petswap3")
    Call("round1")
    Call("round1")
    Call("round1")
    Call("round1")

    ;last middle enter rounds after this

    Call("clearInv")

WEnd

Something like this, and hey john thanks for last time!

And Chimp, this is to make the GUI exit when pressing the button right?

Share this post


Link to post
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("THIS IS THE INSTRUCTION SCREEN", 748, 539, 299, 102)
$Pic1 = GUICtrlCreatePic("C:\Users\Sabbih\Desktop\website\Setupscreen2.jpg", -17, 0, 764, 556)
$Button1 = GUICtrlCreateButton("Start VanityBot!", 271, 432, 193, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            _Func()
    EndSwitch
WEnd

Func _Func()
    While 1
        Call("petswap")
        Call("round1")
        Call("round1")
        Call("round1")

        ;last middle enter rounds after this
        Call("round1")
        Call("round1")
        Call("clearInv")

        Call("round1")
        Call("round1")
        Call("petswap2")

        Call("round1")
        Call("round1")
        Call("round1")

        ;last middle enter rounds after this


        Call("clearInv")


        ;3rd petswap


        Call("round1")
        Call("round1")
        Call("petswap3")
        Call("round1")
        Call("round1")
        Call("round1")
        Call("round1")

        ;last middle enter rounds after this

        Call("clearInv")

    WEnd
EndFunc   ;==>_Func


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

So after putting this to test it, i noticed that the button doesnt even get pushed in. 

Its just an image it seems, and is not responding when i click on it.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("THIS IS THE INSTRUCTION SCREEN", 748, 539, 299, 102)
$Pic1 = GUICtrlCreatePic("C:\Users\Sabbih\Desktop\website\Setupscreen2.jpg", -17, 0, 764, 556)
$Button1 = GUICtrlCreateButton("Start VanityBot!", 271, 432, 193, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            _test ()
    EndSwitch
WEnd

Func _test ()
    MsgBox( 0,"hi", "test")
    EndFunc
Edited by Webcreation

Share this post


Link to post
Share on other sites

Works just fine.

I have absolutely no idea why a button would not work.

Well, one. There is tons more code in your script you are not showing where the code is stuck.

If the above code on it's own does not show the message box, your computer has big problems.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

I am making the GUI seperate from the main script so that i would know it works 100%...

Im guessing my PC has big problems then.

I will try more before coming back. Thanks for the help.

Share this post


Link to post
Share on other sites

Did, but still didnt work. I think something else went wrong in that particular script. Because i tried this code in a new .au3 and it worked first try!

Thank you John this is solved.

So if i let the button do an Exit, it will exit script.. but i just want it to exit the GUI and continu script. Do you know what i should put

Share this post


Link to post
Share on other sites

...

Something like this, and hey john thanks for last time!

And Chimp, this is to make the GUI exit when pressing the button right?

 

yes, right

 

So after putting this to test it, i noticed that the button doesnt even get pushed in. 

Its just an image it seems, and is not responding when i click on it.

 

read the help for the GUICtrlCreatePic command where you can found this phrase:

"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE)."


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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