Jump to content

End GUI but not script


JLC123
 Share

Recommended Posts

I know this is probably pretty basic, but I can't figure it out.

I have a GUI that asks for the user to select three variables. Now I want to END the GUI and move on with my code using the info gathered from the user.

How? Once I end my GUI loop it's all over but the cryin'

Thanks in advance

Dim $title = 'Install'; Window Title.
Dim $font = "Trebuchet MS"

#include <GUIConstants.au3>

$main = GUICreate($title, 350, 400)
GUISetFont(11, 40, "", $font)
GUICtrlCreateLabel("", 60, 380, -1, 15)

GUICtrlCreateGroup('Make Selections', 10, 10, 330, 360)
GUICtrlCreateLabel('Enter machine type, concept' &@CRLF& 'number', 15, 40, 300, 100)
$mac = GUICtrlCreateCombo ("Select Machine Type", 30,140)
GUICtrlSetData(-1,"IBM_6339|IBM_6792|NCR_3234|NCR_3236|NCR_3237|NCR_3239")

$con = GUICtrlCreateCombo ("Select Concept", 30,220)
GUICtrlSetData(-1,"Concept #1|Concept #2|Concept #3")

GUICtrlCreateLabel('Type in Four Digit' & @CRLF & 'Code Number', 30, 280, 131, 42, 0x1000)
$rest = GUICtrlCreateInput('', 30, 320, 131, 20)

$GO = GUICtrlCreateButton('Install', 230, 310, 70, 30)
GUICtrlSetState($GO, $GUI_ENABLE)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GO
        If GUICtrlRead($mac) = "Select Machine Type" Then
            MsgBox(16, $title, "Please select a machine type!")
        Else
            FileWrite("c:\temp\temp.txt", GUICtrlRead($mac))
        EndIf
        If GUICtrlRead($con) = "Select Concept" Then
            MsgBox(16, $title, "Please select a concept!")
        Else
            FileWrite("c:\temp\temp.txt", GUICtrlRead($con))
        EndIf
        If GUICtrlRead ($rest) = 0 Then
            MsgBox(16, $title, "Please enter a code number!")
        Else
            FileWrite("c:\temp\temp.txt", GUICtrlRead($rest))
        EndIf
    EndSelect
    If $msg = $GUI_EVENT_CLOSE Then Exit
Wend

RunWait(@ComSpec & " /c " & 'netpanel.bat', "")

Two wrongs don't make a right, but three lefts do

Link to comment
Share on other sites

Put an ExitLoop in the While...Wend loop... It will continue after the Wend :o

Good news and bad news. The script moves on without the GUI, but it's not waiting for any user input.

B)

Two wrongs don't make a right, but three lefts do

Link to comment
Share on other sites

  • Developers

Good news and bad news. The script moves on without the GUI, but it's not waiting for any user input.

B)

This is too cryptic to comment on.. you need to show your modified code ..... and explain the Userinput required ...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This is too cryptic to comment on.. you need to show your modified code ..... and explain the Userinput required ...

Sorry - Here's the new code.

I added the "ExitLoop" before the Wend as suggested.

Without the "ExitLoop" line the user clicks on the "install" button and the code checks to make sure there is valid user input for all three controls (2 combos and one input)

Once we're sure that's happened, I want to GUI to go away and I'll run the rest of my code.

With the "ExitLoop" in there the code moves on but before the user even has a chance to enter anything, much less verify what they've entered by clicking "install".

Dim $title = 'Install'; Window Title.
Dim $font = "Trebuchet MS"

#include <GUIConstants.au3>

$main = GUICreate($title, 350, 400)
GUISetFont(11, 40, "", $font)
GUICtrlCreateLabel("", 60, 380, -1, 15)

GUICtrlCreateGroup('Make Selections', 10, 10, 330, 360)
GUICtrlCreateLabel('Enter machine type, concept' &@CRLF& 'number', 15, 40, 300, 100)
$mac = GUICtrlCreateCombo ("Select Machine Type", 30,140)
GUICtrlSetData(-1,"IBM_6339|IBM_6792|NCR_3234|NCR_3236|NCR_3237|NCR_3239")

$con = GUICtrlCreateCombo ("Select Concept", 30,220)
GUICtrlSetData(-1,"Concept #1|Concept #2|Concept #3")

GUICtrlCreateLabel('Type in Four Digit' & @CRLF & 'Code Number', 30, 280, 131, 42, 0x1000)
$rest = GUICtrlCreateInput('', 30, 320, 131, 20)

$GO = GUICtrlCreateButton('Install', 230, 310, 70, 30)
GUICtrlSetState($GO, $GUI_ENABLE)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GO
        If GUICtrlRead($mac) = "Select Machine Type" Then
            MsgBox(16, $title, "Please select a machine type!")
        EndIf
        If GUICtrlRead($con) = "Select Concept" Then
            MsgBox(16, $title, "Please select a concept!")
        EndIf
        If GUICtrlRead ($rest) = 0 Then
            MsgBox(16, $title, "Please enter a code number!")
        EndIf
    EndSelect
    If $msg = $GUI_EVENT_CLOSE Then Exit
        ExitLoop
Wend

RunWait(@ComSpec & " /c " & 'netpanel.bat', "")

Two wrongs don't make a right, but three lefts do

Link to comment
Share on other sites

  • Developers

what about trying it with this logic:

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GO
            If GUICtrlRead($mac) = "Select Machine Type" Then
                MsgBox(16, $title, "Please select a machine type!")
                ContinueLoop
            EndIf
            If GUICtrlRead($con) = "Select Concept" Then
                MsgBox(16, $title, "Please select a concept!")
                ContinueLoop
            EndIf
            If GUICtrlRead($rest) = 0 Then
                MsgBox(16, $title, "Please enter a code number!")
                ContinueLoop
            EndIf
            ExitLoop
    EndSelect
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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