Jump to content

Getting Error Using Case With Varibles


Recommended Posts

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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,)

 

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