Jump to content

MsgBox


Recommended Posts

Nah dude. If u check it better u will find the difference.

The syntax is a different way but the outcome is exactly the same.

If MsgBox(4, "", "") = 6 Then
    ConsoleWrite("Yes" & @LF)
Else
    ConsoleWrite("No" & @LF)
EndIf

Local $iMsgBox = MsgBox(4, "", "")
If $iMsgBox = 6 Then
    ConsoleWrite("Yes" & @LF)
Else
    ConsoleWrite("No" & @LF)
EndIf
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Are you suggesting MsgBox Returns a different value when a variable is waiting to receive it?

No it returns what it has to. Check this.

While using M23

Case $hButton5
    ; Create MsgBox and wait for the user to click a button on the MsgBox
    If MsgBox(4, "Update", " Check for updates?") = 6 Then
        ; If the "Yes" button was pressed
        gui3()
    Else
        ; In all other cases
        Exit
    EndIf
im not checking return of MsgBox, im still using the cotrolID of $hButton5.

Case $hButton5
    ; Create MsgBox and wait for the user to click a button on the MsgBox
   $msgbox =f MsgBox(4, "Update", " Check for updates?") = 6 Then
        ; If the "Yes" button was pressed
        gui3()
    Else
        ; In all other cases
        Exit
    EndIf
using this way i guess i get the controll of the MsgBox and then it returns the value a MsgBox should return.

I feel nothing.It feels great.

Link to comment
Share on other sites

I don't know where you got the Idea you are using $hButton5.

These two perform the exact same task, and have the exact same result.

Case $hButton5
    ; Create MsgBox and wait for the user to click a button on the MsgBox
    If MsgBox(4, "Update", " Check for updates?") = 6 Then
        ; If the "Yes" button was pressed
        gui3()
    Else
        ; In all other cases
        Exit
    EndIf

Case $hButton5
    ; Create MsgBox and wait for the user to click a button on the MsgBox
    $MsgBox = MsgBox(4, "Update", " Check for updates?")
    If  $MsgBox = 6 Then
        ; If the "Yes" button was pressed
        gui3()
    Else
        ; In all other cases
        Exit
    EndIf

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

@ileandros - Your second example won't work.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I don't know where you got the Idea you are using $hButton5.

These two perform the exact same task, and have the exact same result.

Case $hButton5
    ; Create MsgBox and wait for the user to click a button on the MsgBox
    If MsgBox(4, "Update", " Check for updates?") = 6 Then
        ; If the "Yes" button was pressed
        gui3()
    Else
        ; In all other cases
        Exit
    EndIf

Case $hButton5
    ; Create MsgBox and wait for the user to click a button on the MsgBox
    $MsgBox = MsgBox(4, "Update", " Check for updates?")
    If  $MsgBox = 6 Then
        ; If the "Yes" button was pressed
        gui3()
    Else
        ; In all other cases
        Exit
    EndIf

Try it out with script I'm giving above. I know they are the same but I used to get the error while using M23 script. Making MsgBox a variable I get the control of the MsgBox and then it gives me the value it normally should. Add the 2 scripts at the program i have above and maybe u will se the difference.

I feel nothing.It feels great.

Link to comment
Share on other sites

  • Moderators

ileandros,

I get the control of the MsgBox

No you do not. You get the return value from the MsgBox function. :)

As several people have already told you, the 2 code snippets are functionally identical. You may get an error using the $MsgBox variable if you have not previously declared it, but both snippets will either run your gui3 function or exit depending on the button you press. ;)

You will not convince anyone else here that there is a difference - so please stop trying. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

@ ileandros

Dude if i was you i would slow down and try and understand what they are telling you M23 JohnOne ,guinness and others know what they are talking about

and all you seem to be doing is trying to prove they are wrong

My advice - give it up.

These are people you listen to without exception, for all three to say the same thing you need to reevaluate your thinking.

Link to comment
Share on other sites

@ ileandros

Dude if i was you i would slow down and try and understand what they are telling you M23 JohnOne ,guinness and others know what they are talking about

and all you seem to be doing is trying to prove they are wrong

My advice - give it up.

These are people you listen to without exception, for all three to say the same thing you need to reevaluate your thinking.

Hey friend im not trying to prove something here. I wouldn't dare if i was wrong.

Check the scripts

This one is the people are suggesting me. Open it and try the $hButton5 MsgBox answers. Try the YES and No answer. They both give the same resault.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

gui1()

Func gui1()

$hForm1 = GUICreate("", 674, 190, 195, 130)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,295,35,330,110)
$hButton1 = GUICtrlCreateButton("", 295, 150, 50, 25)
$hButton3 = GUICtrlCreateButton("", 355, 150, 50, 25)
$hButton5 = GUICtrlCreateButton("?",660,1,15,20)
$hButton2 = GUICtrlCreateButton("", 40, 150, 80, 25)
$hButton4 = GUICtrlCreateButton("Exit", 545, 150, 80, 25)
$List1 = GUICtrlCreateList("", 40, 35, 201, 110)
GUICtrlSetData(-1,"")
$hGroup1 = GUICtrlCreateGroup("", 24, 16, 230, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hGroup2 = GUICtrlCreateGroup("", 280, 16, 365, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)



GUISetState(@SW_SHOW)



    While 1
        $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
        Switch $aMsg[1] ; check which GUI sent the message
            Case $hForm1
                Switch $aMsg[0] ; Now check for the messages for $hGUI1
                    Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<<
                        ExitLoop




Case $hButton5
MsgBox (4,"Update", " Check for updates?")
if $hButton5 = 6 Then
gui3()
Else
Exit


EndIf
Case $hButton4
MsgBox(0,"Exit","Now exiting...")
Exit



                EndSwitch
            Case $hGUI2
                Switch $aMsg[0] ; Now check for the messages for $hGUI2
                    Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<
                        GUIDelete($hGUI2)
                        GUICtrlSetState($hButton2, $GUI_ENABLE)
                EndSwitch
        EndSwitch
    WEnd

EndFunc   ;==>gui1

Func gui2()

$hGUI2 = GUICreate("Youtube",800,600,200,50)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,10,10,780,580)
_IENavigate($oIE,"")
GUISetState(@SW_SHOW)

EndFunc

Func gui3()

$hGUI2 = GUICreate("",1000,600,200,50)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,10,10,980,580)
_IENavigate($oIE,"http://www.google.gr/")
GUISetState(@SW_SHOW)

EndFunc

And the second one is what im talking about. At the first script the answer YES and NO have the same resault. Here the answer YES takes the gui3() order and the answer NO exits the func

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

Global $hGUI2 = 9999, $hButton3 = 9999 ; Predeclare the variables with dummy values to prevent firing the Case statements

gui1()

Func gui1()

$hForm1 = GUICreate("", 674, 190, 195, 130)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,295,35,330,110)
$hButton1 = GUICtrlCreateButton("", 295, 150, 50, 25)
$hButton3 = GUICtrlCreateButton("", 355, 150, 50, 25)
$hButton5 = GUICtrlCreateButton("?",660,1,15,20)
$hButton2 = GUICtrlCreateButton("", 40, 150, 80, 25)
$hButton4 = GUICtrlCreateButton("Exit", 545, 150, 80, 25)
$List1 = GUICtrlCreateList("", 40, 35, 201, 110)
GUICtrlSetData(-1,"")
$hGroup1 = GUICtrlCreateGroup("", 24, 16, 230, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hGroup2 = GUICtrlCreateGroup("", 280, 16, 365, 170)
GUICtrlCreateGroup("", -99, -99, 1, 1)



GUISetState(@SW_SHOW)



    While 1
        $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
        Switch $aMsg[1] ; check which GUI sent the message
            Case $hForm1
                Switch $aMsg[0] ; Now check for the messages for $hGUI1
                    Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<<
                        ExitLoop




Case $hButton5
MsgBox (4,"Update", " Check for updates?")
if $hButton5 = 6 Then
gui3()
Else
Exit


EndIf
Case $hButton4
MsgBox(0,"Exit","Now exiting...")
Exit



                EndSwitch
            Case $hGUI2
                Switch $aMsg[0] ; Now check for the messages for $hGUI2
                    Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<<
                        GUIDelete($hGUI2)
                        GUICtrlSetState($hButton2, $GUI_ENABLE)
                EndSwitch
        EndSwitch
    WEnd

EndFunc   ;==>gui1

Func gui2()

$hGUI2 = GUICreate("Youtube",800,600,200,50)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,10,10,780,580)
_IENavigate($oIE,"")
GUISetState(@SW_SHOW)

EndFunc

Func gui3()

$hGUI2 = GUICreate("",1000,600,200,50)
$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,10,10,980,580)
_IENavigate($oIE,"http://www.google.gr/")
GUISetState(@SW_SHOW)

EndFunc
Edited by ileandros

I feel nothing.It feels great.

Link to comment
Share on other sites

  • Moderators

ileandros,

I am normally the most patient person around here but I am about to make an exception - just for you. ;)

Are you trying to wind us up or are you really as stupid as you seem to be? ;)

Neither of those examples do what you want because in both cases you are still using the ControlID of $hButton5 to run the If statement.

; Your first example:
Case $hButton5
    MsgBox(4, "Update", " Check for updates?")
    If $hButton5 = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

; Your second example
Case $hButton5
    MsgBox(4, "Update", " Check for updates?")
    If $hButton5 = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

As we have been trying to tell you for 2 pages now, you need to check the return value of the MsgBox. You can do this 2 ways:

; First way
Case $hButton5
    $iMsgBox = MsgBox(4, "Update", " Check for updates?") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    If $iMsgBox = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

; Second way
Case $hButton5
    If MsgBox(4, "Update", " Check for updates?") = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

If you really cannot see what we are telling you then I suggest you give up scripting and take up some other hobby instead because we are not prepared to go on explaining the same thing over and over and over and over again. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

ileandros,

I am normally the most patient person around here but I am about to make an exception - just for you. ;)

Are you trying to wind us up or are you really as stupid as you seem to be? ;)

Neither of those examples do what you want because in both cases you are still using the ControlID of $hButton5 to run the If statement.

; Your first example:
Case $hButton5
    MsgBox(4, "Update", " Check for updates?")
    If $hButton5 = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

; Your second example
Case $hButton5
    MsgBox(4, "Update", " Check for updates?")
    If $hButton5 = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

As we have been trying to tell you for 2 pages now, you need to check the return value of the MsgBox. You can do this 2 ways:

; First way
Case $hButton5
    $iMsgBox = MsgBox(4, "Update", " Check for updates?") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    If $iMsgBox = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

; Second way
Case $hButton5
    If MsgBox(4, "Update", " Check for updates?") = 6 Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        gui3()
    Else
        Exit
    EndIf

If you really cannot see what we are telling you then I suggest you give up scripting and take up some other hobby instead because we are not prepared to go on explaining the same thing over and over and over and over again. :)

M23

I don't know if its my computer or problem something else but as i already told u at the start of the conversation.You suggested this to me and i already told u that i got a problem.

I am not saying that im not checking the return value of the MsgBox. I'm saying that the seconf way doesn't do it. At least it doesn't do ti for me. I don't know why but i know that it doesn't.

The first way does it. i said that i GUESS making the MsgBox a variable make it work fine. :/

Edited by ileandros

I feel nothing.It feels great.

Link to comment
Share on other sites

If this works >> then there is nothing wrong with your PC, by the way helps to let us know what Windows you have as well as AutoIt you're using. If my example (which I posted a couple of days ago) works then re-read Melba's post because you failed to miss the point that your latest code won't work, hint you're using the ControlID and not MsgBox return value.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

ileandros,

Now I am back from the gym and have worked off my frustrations (and if it hurts tomorrow I know who I am going to blame! ;)) I am going to make one last try to explain.

When you create a control, AutoIt allocates it a ControlID - this is what AutoIt uses to identify the control and it is what you are storing in the $hButton5 variable. Entirely by chance in both the scripts you posted above the ControlID of that button is 6. So when the button is clicked, GUIGetMsg will return that ControlID - you detect it in your Case $hButton line.

The code you have appears to be working because entirely by chance the numeric value of the ControlID happens to be one of the possible return values from the MsgBox function - that returned by the "Yes" button. So your code only appears to work because you created Button5 at that particular point of the script - move the $hButton5 = GUICtrlCreateButton a line earlier or a line later and you will always exit as the ControlID will no longer have the same value as the "Yes" return.

Using either of the snippets I gave you above will correctly check the return value of the MsgBox and your script will work as you wish.

Do you understand now? :)

M23

P.S. Please stop using the "Quote" button to reply - we know what we said. Use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom. ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Not to confuse the issue, but I don't think he wanted it to exit the script ... just the MsgBox.

He solved his problem at post #16.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

  • Moderators

ripdad,

He solved his problem at post #16

I quite agree. But the OP seems not to have understood WHY it was solved and insists that all the suggested solutions will not work. :)

My aim here is to get people to understand WHY the code does what it does - or else they will keep making the same mistakes over and over again. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

I dont say tha all the other suggested will not work. I'm saying that they dont work. I understand what ur saying but it seems that ur not understanding what im saying. And thats my fault because im not explaining in good. I posted the progg above with the two ways - the suggested one and mine. Im saying that the suggested one doesnt work the way it is. It might work if i build with an other way but it doesnt like the way it is. I understand what ur saying now though :-) Well since the problem is solved there is no reason talking anymore.

I feel nothing.It feels great.

Link to comment
Share on other sites

  • Moderators

ileandros,

I dont say tha all the other suggested will not work. I'm saying that they dont work

Which is the same thing. ;)

I understand what ur saying now though

I hope so. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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