Sign in to follow this  
Followers 0
Drew

Program runs, the GUI flashs, program closes.

6 posts in this topic

I run my program I made, and the GUI I created flashes up on the screen and then immediately closes. I don't understand why its doing this. It should stay open so the user can hit on of the buttons.

heres the script:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; AutoIt Version: 3.0
; Language:    English
; Platform:    WinXP
; Author:        Kade Youmans ( Dreu )
;
; Script Function:
;   Created for the sole benefit of D2War.Com and its members.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


; "To Do" List:
;       -Configure buttons to their appropriate actions.
;       -Get the up to date D2War File pack.
;       -Write the Read Me !CHECK!


;
; GUI Controls, Setup.
;

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Description = GUICreate("D2War Installer", 633, 248, 193, 125)
GUISetFont(14, 400, 0, "MS Sans Serif")
GUISetBkColor(0x000000)
$Heading = GUICtrlCreateLabel("D2War Installer", 104, 24, 433, 84)
GUICtrlSetFont(-1, 46, 800, 0, "Sylfaen")
GUICtrlSetColor(-1, 0x800000)
$Install = GUICtrlCreateButton("Install Now", 40, 120, 193, 33, 0)
GUICtrlSetFont(-1, 18, 800, 2, "Comic Sans MS")
GUICtrlSetTip(-1, "Click this to insall D2War Now.")
$ReadMe = GUICtrlCreateButton("Read Me", 392, 120, 185, 33, 0)
GUICtrlSetFont(-1, 18, 800, 2, "Comic Sans MS")
GUICtrlSetTip(-1, "Click this to view the Read Me.")
$Label1 = GUICtrlCreateLabel("Created by: Dreu", 240, 200, 146, 28)
GUICtrlSetColor(-1, 0x808000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $Msg = GUIGetMsg()
    Select
        Case $GUI_EVENT_CLOSE
                ExitLoop
        Case $Msg = $Install
                MsgBox( 0, "Not done yet.", "Dreu hasn't programmed this feature yet.")
        Case $Msg = $ReadMe
                ShellExecute(@ScriptDir &"\ReadMe.txt", 0)
    EndSelect
WEnd

Share this post


Link to post
Share on other sites



Considering the very short reply you gave me, I have a feeling its something extremely simple you expect me to already understand.

But I'm going to be honest... I have no idea where the mess up is, or how to use your example to fix.

Share this post


Link to post
Share on other sites

Considering the very short reply you gave me, I have a feeling its something extremely simple you expect me to already understand.

But I'm going to be honest... I have no idea where the mess up is, or how to use your example to fix.

Case $GUI_EVENT_CLOSE

ExitLoop

Case $Msg = $Install

MsgBox( 0, ....

Case $Msg = $ReadMe

replace yours with his

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

It's always the simplest detail that throws you completely off. =)

A Big thank you to you, Gary, for helping me. A special thanks to Valuater for helping me understand what he meant =).

The program works great, and I couldn't be happier.

Edited by Drew

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Just to complete the answer to your original question, Drew - the GUI would close soon after opening...

#include <GUIConstants.au3>
If $GUI_EVENT_CLOSE Then
    $CLOSE_MY_WINDOW = True
Else
    $CLOSE_MY_WINDOW = False
EndIf
$myRet = MsgBox(262144+0+64+4, _
            'Basic Results', _
            '$GUI_EVENT_CLOSE = ' & $GUI_EVENT_CLOSE _
    & @CR & '' _
    & @CR & '$CLOSE_MY_WINDOW = ' &$CLOSE_MY_WINDOW _
    & @CR & '' _
    & @CR & 'If $CLOSE_MY_WINDOW = "True", then click "Yes"  ' _
    & @CR & '')
If $myRet == 7 Then
    MsgBox(262144+0+16, "Hey You!", "Do you know how wrong you are!?   ")
Else
    MsgBox(262144+0+48, "Dude:", "I'm okay, you're okay ")
EndIf

...because "Case $GUI_EVENT_CLOSE" evaluated to a boolean value of True in the following case structure:

Select
        Case $GUI_EVENT_CLOSE
                ExitLoop
        Case $Msg = $Install
                MsgBox( 0, "Not done yet.", "Dreu hasn't programmed this feature yet.")
        Case $Msg = $ReadMe
                ShellExecute(@ScriptDir &"\ReadMe.txt", 0)
    EndSelect

...notice upon which would not, as it happens, fully warrant a referral of said interrogative agent to verse 6 of the Canon of Valik (see below) whilst considering said violation unmitigated.

:)

Edited by Squirrely1

Das Häschen benutzt Radar

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