Jump to content

GUI with a button..


 Share

Go to solution Solved by JohnOne,

Recommended Posts

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!

Link to comment
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?

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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

Link to comment
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)."

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...