Sign in to follow this  
Followers 0
xuzo

Why is the task not going forward to next message box?

22 posts in this topic

Wondering why the task is not going to next step:

MsgBox(64, "A", "B")

here is the code:

#include 
#include 
#include 
#include 
#include 
#region ### START Koda GUI section ### Form=
Local $Form1 = GUICreate("Form1", 466, 202)
Local $Name = GUICtrlCreateLabel("Name", 120, 120, 36, 17)
Local $BrowserType = GUICtrlCreateInput("Please Select Browser Type", 176, 120, 121, 21)
Local $Submit = GUICtrlCreateButton("Submit", 328, 120, 75, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $BrowserType
MsgBox(64, "You selected:", GUICtrlRead($BrowserType))
Exit
EndSwitch
WEnd

MsgBox(64, "A", "B")

Share this post


Link to post
Share on other sites



Because the only statement that whill ever leave the "While 1 / WEnd" loop exits the script and therefore never executes the MsgBox statement.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

xuzo,

Because you tell the script to "Exit" when the edit control is actioned - you need to use "ExitLoop" so that the script cntinues. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I sound sooooo stupid..but trying! Tried both ways, not working:

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $BrowserType
MsgBox(64, "You selected:", GUICtrlRead($BrowserType))
Exit
EndSwitch
WEnd
Exit
MsgBox(64, "A", "B")

And :

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            MsgBox(64, "You selected:", GUICtrlRead($BrowserType))
            Exit
    EndSwitch
WEnd
ExitLoop
MsgBox(64, "A", "B")

Share this post


Link to post
Share on other sites

xuzo,

:D

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 466, 202)
$Name = GUICtrlCreateLabel("Name", 120, 120, 36, 17)
$BrowserType = GUICtrlCreateInput("Please Select Browser Type", 176, 120, 121, 21)
$Submit = GUICtrlCreateButton("Submit", 328, 120, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            MsgBox(64, "You selected:", GUICtrlRead($BrowserType))
            ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch
WEnd

MsgBox(64, "A", "B")

And anyway why are you not using a combo to get the selection? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks, works now!

I'm missing so many basics...like learning to be a carpenter, I can use a hammer but don't know what a nail is...!

I have more stupid questions comming unfortunately... :sweating:

Cheers!

Share this post


Link to post
Share on other sites

No problem, let them roll in. We'll try to answer any question as long as we can see some effort from your side.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Great! Ok, here's one more!

Is it better to open a new thread or keep going with the one started by the way?

So now I want to wait until the GUI is gone before moving on.

I've experimented with Sleep, and WinWait, WinWaitClose ect...but can't seem to get it right...here it is:

#include 
#include 
#include 
#include 
#include 
$Form1 = GUICreate("Form1", 400, 400)
$Name = GUICtrlCreateLabel("Name", 120, 120, 36, 17)
$BrowserType = GUICtrlCreateInput("Please Select Browser Type", 176, 120, 121, 21)
$Submit = GUICtrlCreateButton("Submit", 328, 120, 75, 25)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $BrowserType
;sgBox(64, "You selected:", GUICtrlRead($BrowserType))
ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
EndSwitch
WEnd
WinWaitClose("Form1")
Run("notepad.exe")
Sleep(1000)
WinWait("Untitled - Notepad")
Send(GUICtrlRead($BrowserType))
WinClose("Untitled - Notepad")
Send("!n")

Share this post


Link to post
Share on other sites

Use function GUIDelete if the GUI is no longer needed.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

xuzo,

Just amend the action to take when the GUI is closed: ;)

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 400, 400)
$Name = GUICtrlCreateLabel("Name", 120, 120, 36, 17)
$BrowserType = GUICtrlCreateInput("Please Select Browser Type", 176, 120, 121, 21)
$Submit = GUICtrlCreateButton("Submit", 328, 120, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        Case $BrowserType
            MsgBox(64, "You selected:", GUICtrlRead($BrowserType))
    EndSwitch
WEnd

MsgBox(0, "Hi", "GUI closed")

Is it better to open a new thread or keep going with the one started by the way?

If your new question is closely related to the thread then by all means keep going. But if you are going off on a tangent then please start a new one. Not that you need much encouragement to do so so far. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank

GUIDelete() does work, but then I loose the value...it kills everything:

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $BrowserType
;sgBox(64, "You selected:", GUICtrlRead($BrowserType))
ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
EndSwitch
WEnd
GUIDelete()
Run("notepad.exe")
Sleep(1000)
WinWait("Untitled - Notepad")
Send(GUICtrlRead($BrowserType))
WinClose("Untitled - Notepad")
Send("!n")

Then I tried this but doesn't work:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            ;sgBox(64, "You selected:", GUICtrlRead($BrowserType))
            ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch
WEnd
GUI_EVENT_CLOSE()
Run("notepad.exe")
Sleep(1000)
WinWait("Untitled - Notepad")
Send(GUICtrlRead($BrowserType))
WinClose("Untitled - Notepad")
Send("!n")

Not working:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            ;sgBox(64, "You selected:", GUICtrlRead($BrowserType))
            ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch
WEnd
WinWaitClose("Form1")
Run("notepad.exe")
Sleep(1000)
WinWait("Untitled - Notepad")
Send(GUICtrlRead($BrowserType))
WinClose("Untitled - Notepad")
Send("!n")

Share this post


Link to post
Share on other sites

But if you want to remove the GUI from the screen before your script is closed you need to use GUIDelete.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

You have to store the selection in a variable because all GUI related functions return an error when called after GUIDelete.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            $sSelection = GUICtrlRead($BrowserType)
            ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch
WEnd
GUI_EVENT_CLOSE()
Run("notepad.exe")
Sleep(1000)
WinWait("Untitled - Notepad")
Send($sSelection)
WinClose("Untitled - Notepad")
Send("!n")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks Melba,

I tried your script and works fine, but I want the GUI to close itself alone after clicking on submit without having to click on the Minimize X

Trying this now:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            ;sgBox(64, "You selected:", GUICtrlRead($BrowserType))
            ExitLoop ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    EndSwitch
    WinClose("Form1")
WEnd

WinWaitClose("Form1")
Run("notepad.exe")
Sleep(1000)
WinWait("Untitled - Notepad")
Send(GUICtrlRead($BrowserType))
WinClose("Untitled - Notepad")
Send("!n")

Share this post


Link to post
Share on other sites

xuzo,

You need to phrase your questions better - you asked how to wait until the GUI had closed, not how to close it! ;)

And water has already given you the answer:

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 400, 400)
$Name = GUICtrlCreateLabel("Name", 120, 120, 36, 17)
$BrowserType = GUICtrlCreateInput("Please Select Browser Type", 176, 120, 121, 21)
$Submit = GUICtrlCreateButton("Submit", 328, 120, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BrowserType
            MsgBox(64, "You selected:", GUICtrlRead($BrowserType))
            GUIDelete($Form1) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            ExitLoop
    EndSwitch
WEnd

MsgBox(0, "Hi", "GUI closed")

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Hi Water,

Thank you, that's exactly what I wanted to do!

Edited by xuzo

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Hi Melba,

yes, sorry, not always sure how to ask, might be better to go little steps by steps and thread by thread?

One small question at a time is better I think?

Indeed the code that water gave is 100% what I wanted to do.

Thanks

Edited by xuzo

Share this post


Link to post
Share on other sites

[solved]

Share this post


Link to post
Share on other sites

Using variables and creating simple GUIs are such basic tasks that I would recommend (before you do further coding) to have a look at the Wiki and check the tutorials. There you find good descriptions and examples how things work.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi Water,

Thanks for the link, I've been to that page and checked all the links;)

I read everything....problem is I lack the basics, I mean all I know is like stuff from high school 25 years ago like:

X=Y and Y=Z so X=Z ...that is basically the extend of my knowledge about that type of programming although I know HTML and CSS...!

Cheers!

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