Jump to content

Case Statements


Recommended Posts

Hi,

Can someone kindly help me with one case statement? Pls provide me with the actual coding for the case statement and I believe I can pick up from there.

Thanks.

#include <GuiConstants.au3>

GuiCreate("Printer Port Selector 1.0", 391, 323,(@DesktopWidth-391)/2, (@DesktopHeight-323)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$var1 = RegEnumVal("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", 1)
$var1a = RegRead("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", $var1)

$var2 = RegEnumVal("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", 2)
$var2a = RegRead("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", $var2)

$var3 = RegEnumVal("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", 3)
$var3a = RegRead("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", $var3)

$var4 = RegEnumVal("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", 4)
$var4a = RegRead("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices", $var4)

$Group_1 = GuiCtrlCreateGroup("Printers", 20, 0, 350, 140)
$Group_2 = GuiCtrlCreateGroup("Ports", 20, 160, 350, 100)

$Button_1 = GuiCtrlCreateButton("OK", 60, 280, 90, 30)
$Button_2 = GuiCtrlCreateButton("Cancel", 240, 280, 90, 30)

GUIStartGroup()
$Radio_1 = GuiCtrlCreateRadio($var1 & " " & $var1a, 40, 20, 300, 20)
$Radio_2 = GuiCtrlCreateRadio($var2 & " " & $var2a, 40, 50, 300, 20)
$Radio_3 = GuiCtrlCreateRadio($var3 & " " & $var3a, 40, 80, 300, 20)
$Radio_4 = GuiCtrlCreateRadio($var4 & " " & $var4a, 40, 110, 300, 20)

GUIStartGroup()
$Radio_A = GuiCtrlCreateRadio("LPT1:", 60, 190, 70, 20)
$Radio_B = GuiCtrlCreateRadio("LPT2:", 240, 190, 70, 20)
$Radio_C = GuiCtrlCreateRadio("USB001", 60, 230, 70, 20)
$Radio_D = GuiCtrlCreateRadio("USB002", 240, 230, 70, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_2
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

mouse not found....scroll any mouse to continue.

Link to comment
Share on other sites

Seeing as both $msg = Exitloop. I would not use a Select...EndSelect Statement and instead would just use an If...EndIf.

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE or $msg = $Button_2 Then
        ExitLoop
    Else
      ;Blah
    EndIf
WEnd

qq

Link to comment
Share on other sites

thanks for the fast help!

another question, how do i write a statement if $Radio_1 and $Radio_A are selected (when i press OK button)?

Thanks alot.

mouse not found....scroll any mouse to continue.

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