Jump to content
Sign in to follow this  
TSO

Radio Buttons Problem

Recommended Posts

TSO

I'm having an issue getting the script to identify when a radio option is chosen AND $Button1 is clicked. It will only execute the $Radio1 option, no matter which radio button is selected. Any help would be greatly appreciated.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\s830829\Desktop\Scripts\EUSROS.kxf

$supStat = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization")

$Form2 = GUICreate("EUS Redirect Tool", 293, 198, 287, 193)
$Radio1 = GUICtrlCreateRadio("EUS Supported", 16, 40, 113, 17)
$Radio2 = GUICtrlCreateRadio("No Bill", 16, 72, 113, 17)
$Radio3 = GUICtrlCreateRadio("Group 3", 16, 104, 113, 17)
$Button1 = GUICtrlCreateButton("Change", 16, 152, 115, 33, 0)
$Button2 = GUICtrlCreateButton("Exit", 160, 152, 115, 33, 0)
$Label3 = GUICtrlCreateLabel($supStat, 160, 40, 91, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("Change Support Group:", 8, 16, 129, 121)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Current Support Group:", 152, 16, 129, 49)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

While 1
     $nMsg = GUIGetMsg()
     Select
    Case $nMsg = $Radio1 AND $Button1
       RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", "EUS Supported")
       MsgBox(0, "EUS Redirect Tool", "This computer has now been added to the EUS Supported database")
    Case $nMsg = $Radio2 AND $Button1
       RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", "No Bill") 
       MsgBox(0, "EUS Redirect Tool", "This computer has now been added to the No Bill database")
    Case $nMsg = $Radio3 AND $Button1
       RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", "Group 3")
       MsgBox(0, "EUS Redirect Tool", "This computer has now been added to the Group 3 database")
    Case $nMsg = $Button2
       Exit  
       
     EndSelect
WEnd
#EndRegion ### END Koda GUI section ###

Share this post


Link to post
Share on other sites
Kerros

You are not reading the state of the radio buttons in that example.

GUICtrlRead($Radio1)

and so on will tell you the state of the radio.


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites
TSO

You are not reading the state of the radio buttons in that example.

GUICtrlRead($Radio1)

and so on will tell you the state of the radio.

I actually did see something about GUICtrlRead and tried

Case $nMsg = GUICtrlRead($Radio1) AND $Button1
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", "EUS Supported")
        MsgBox(0, "EUS Redirect Tool", "This computer has now been added to the EUS Supported database")

...but it didn't have the desired effect, so I know my syntax is f'd.

Share this post


Link to post
Share on other sites
Kerros

Try

Case $nMsg = $Button1 AND GUICtrlRead($Radio1) = $GUI_CHECKED

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites
TSO

Try

Case $nMsg = $Button1 AND GUICtrlRead($Radio1) = $GUI_CHECKED
Awesome dude, I'm pretty sure that's it!!! Thanks Kerros

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.