KutayAltinoklu

Getting Error Using Case With Varibles

3 posts in this topic

#1 ·  Posted (edited)

Thank All Whoever Try To Help Me :)

The Problem is At The End Of The MsgBox(0, $UserData1, $UserData2) Dosent return anything and ım using msgbox understand is it gettin my Datas

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>

$Forma = GUICreate("Form", 291, 261, -1, -1, -1, -1)
$Ext = GUICtrlCreateCombo("..", 50, 50, 193, 21, -1, -1)
GUICtrlSetData(-1, "")
GUICtrlCreateLabel("Manager", 70, 20, 193, 15, -1, -1)
GUICtrlSetFont(-1, 10, 900, 0, "Arial Black")
GUICtrlSetColor(-1, "0x008000")
GUICtrlSetBkColor(-1, "-2")
GUICtrlCreateLabel("Enter HexCode", 80, 80, 193, 15, -1, -1)
GUICtrlSetFont(-1, 10, 900, 0, "Arial Black")
GUICtrlSetColor(-1, "0x008000")
GUICtrlSetBkColor(-1, "-2")
$HexCode = GUICtrlCreateInput("", 50, 109, 193, 20,)
GUICtrlSetState(-1, BitOR($GUI_SHOW, $GUI_ENABLE, $GUI_ONTOP))
Global $BilgiGonder = GUICtrlCreateButton("Bilgileri Gönder", 50, 212, 193, 30, -1, -1)
GUICtrlSetFont(-1, 12, 900, 0, "Arial Black")
GUICtrlSetColor(-1, "0x008000")
$Colour = GUICtrlCreateCombo("", 50, 169, 193, 21, -1, -1)
GUICtrlSetData(-1, "")
GUICtrlCreateLabel("Manager", 70, 142, 193, 15, -1, -1)
GUICtrlSetFont(-1, 10, 900, 0, "Arial Black")
GUICtrlSetColor(-1, "0x008000")
GUICtrlSetBkColor(-1, "-2")
GUISetState(@SW_SHOW, $Test)
; ------------------------------------------------------------------------------
;ComboBox() Değişkenlerini Ayarlar.
; ------------------------------------------------------------------------------
GUICtrlSetData($Ext, ".txt|.ini|")
GUICtrlSetData($Colour, "Red|Blue|Black|Pink|Dark Blue|Magenta|White|Brown")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BilgiGonder
            $UserData1 = GUICtrlRead($Ext)
        ExitLoop
        Case $BilgiGonder
            $UserData2 = GUICtrlRead($Colour)
        ExitLoop    
        Case $BilgiGonder
            $UserData3 = GUICtrlRead($HexCode)
        ExitLoop    
    EndSwitch
WEnd

MsgBox(0, $UserData1, $UserData2)

 

Edited by KutayAltinoklu

Share this post


Link to post
Share on other sites



Switch does not work this way. You can't have 3 Case for the same value. 


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

like water said switch doesn't work that way i guess you should change switch part

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BilgiGonder
            $UserData1 = GUICtrlRead($Ext)
            $UserData2 = GUICtrlRead($Colour)
            $UserData3 = GUICtrlRead($HexCode)
        ExitLoop
    EndSwitch
WEnd

Also you might need to declare $Test

and remove the extra comma at line 19

$HexCode = GUICtrlCreateInput("", 50, 109, 193, 20,)

 

1 person likes this

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