Jump to content

GUI with a button..


Go to solution Solved by JohnOne,

Recommended Posts

Posted

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!

Posted

insert

GUICtrlSetState(-1, $GUI_DISABLE)

right after

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Posted

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?

Posted

#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.

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
Posted

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.

Posted

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.

Posted

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

Posted

  On 9/30/2014 at 10:49 PM, Webcreation said:
...

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

  On 9/30/2014 at 11:05 PM, Webcreation said:

 

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....

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...