Sign in to follow this  
Followers 0
lgnihlman

Newbie questions

2 posts in this topic

I'm new to AutoIt and I try to build an application that has six radio buttons and two input boxes.

The idea is to get the state of the radio buttons and the content of the input boxes and

then an action should be carried out based on wich of the radio buttons is checked.

So my problem is to figure out how to test the state of the radio buttons when the "Anslut" button

is pressed.

Hope someone can/will help me with this.

Regards

Lars-Gunnar Nihlman

#include <GUIConstants.au3>

GUICreate("ZEN - Fjärrkontroll", 412, 412, 302, 168, $WS_OVERLAPPEDWINDOW)

GuiSetIcon(@systemdir & "\nwtray.exe", 0)

GUISetFont(10, 400, 0, "MS Sans Serif")

$GroupBox1 = GUICtrlCreateGroup("Uppgift", 8, 136, 393, 105)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$RC = GUICtrlCreateRadio("Remote control", 16, 160, 113, 17)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$RW = GUICtrlCreateRadio("Remote view", 16, 200, 97, 17)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$FT = GUICtrlCreateRadio("File transfer", 144, 160, 97, 17)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$DI = GUICtrlCreateRadio("Diagnostics", 144, 200, 97, 17)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$RE = GUICtrlCreateRadio("Remote Execute", 256, 160, 121, 17)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$WP = GUICtrlCreateRadio("Remote wakeup", 256, 200, 121, 17)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$Image1 = GUICtrlCreatePic("grlogo.gif", 8, 8, 81, 97)

$Label1 = GUICtrlCreateLabel("Fjärrkontroll för ZEN Works", 120, 24, 200, 21)

GUISetFont(-1, 10, 800, 0, "MS Sans Serif")

$GRUWS = GUICtrlCreateInput("GRUWS", 16, 296, 121, 24)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$Button1 = GUICtrlCreateButton("Anslut", 160, 368, 75, 25)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("Datornamn:", 16, 280, 69, 16)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$KRAD = GUICtrlCreateInput("notepad.exe", 176, 296, 225, 24)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

$Label3 = GUICtrlCreateLabel("Kommandorad:", 176, 280, 92, 16)

GUISetFont(-1, 10, 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

if you want to know which radio is checked try this 1:

$a = guictrlread($RC)
if $a = 1 then
msgbox(0, "Status", "Checked")
elseif $a = 4 then
msgbox(0, "Status", "Unchecked")
endif

just a short example of how you can find out which 1 is checked

Edited by Nuffilein805

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  
Followers 0