Jump to content
Sign in to follow this  
sparkymarky

radio button to select a value

Recommended Posts

sparkymarky

Help is needed for a radio to select a value

I need a radio1 button to select a value $U

then if Radio2 button a value $J is selected.

Then use that value for inputed in another value called $result for example.

I can't find no example how to do this, I tried various thing, no succes..

please help

Share this post


Link to post
Share on other sites
Realm

It's a lot easier to help if you show the code


My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites
FlyinRiz

Help is needed for a radio to select a value

I need a radio1 button to select a value $U

then if Radio2 button a value $J is selected.

Then use that value for inputed in another value called $result for example.

I can't find no example how to do this, I tried various thing, no succes..

please help

You could try something like this...the weird spacing on the GUI is because this is directly from another program of mine (with specific data stripped)

;Create Option GUI
Local $GUI_w = 400
Local $GUI_h = 255
Local $radio1, $radio2, $radio3, $submit1, $gui1
$gui1 = GUICreate("Radio Test", $GUI_w, $GUI_h, (@DesktopWidth-$GUI_w)/2, (@DesktopHeight-$GUI_h)/2)
$radio1 = GUICtrlCreateRadio("Radio 1", 20, 20, $GUI_w-40, 30)
GUICtrlSetFont(-1, 9)
$radio2 = GUICtrlCreateRadio("Radio 2", 20, 60, $GUI_w-40, 30)
GUICtrlSetFont(-1, 9)
$radio3 = GUICtrlCreateRadio("Radio 3", 20, 100, $GUI_w-230, 30)
GUICtrlSetFont(-1, 9)
GUICtrlSetState($radio1, $GUI_CHECKED)
$submit1 = GUICtrlCreateButton("Start",50,145, 125, 40, $BS_DEFPUSHBUTTON)
GUISetState()
;Start GUI loop
While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $submit1
                        ExitLoop
                Case $msg[0] = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            $var1 = 0
        Case $msg[0] = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            $var1 = 1 ;Or another var
        Case $msg[0] = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
            $var1 = 2
        Case $msg[0] = $GUI_EVENT_CLOSE
            Local $quit = MsgBox(36, "Quit?", "Are you sure you want to quit?")
            If $quit = 6 Then
                Exit
            EndIf
    EndSelect
WEnd
GUIDelete($gui1)
;Process result
$result = $var1 * 10
MsgBox(0,"Result",$result)

You'll need to add some includes to actually run it but it should at least get you started.

-Aaron

Edited by FlyinRiz

Share this post


Link to post
Share on other sites
sparkymarky

I added my program, if anyone can help?

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

local $email, $number, $U, $J, $outlook, $submit1, $submit1, $gui1, $result

Opt("GUIOnEventMode",1)

$Form1_1 = GUICreate("Outlook emailer", 532, 231, 168, 124)

$input1 = GUICtrlCreateInput("Email", 24, 40, 481, 21)

$Label1 = GUICtrlCreateLabel("Enter Email address to send to:-", 16, 8, 193, 20)

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

$Label2 = GUICtrlCreateLabel("How many messages to be sent", 8, 80, 195, 20)

$input2 = GUICtrlCreateInput("1", 24, 104, 73, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))

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

GUICtrlSetLimit(-1, 3)

$radio1 = GUICtrlCreateRadio("Outlook 2003", 24, 152, 113, 17)

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

GUICtrlSetState($radio1, $GUI_CHECKED)

$radio2 = GUICtrlCreateRadio("Outlook 2007", 24, 192, 113, 17)

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

$Start = GUICtrlCreateButton("Start", 336, 168, 137, 41, $WS_GROUP)

GUICtrlSetOnEvent($Start,"start")

$filemenu = GUICtrlCreateMenu("File")

$fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)

$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)

$separator1 = GUICtrlCreateMenuItem("", $filemenu)

$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

GUISetState (@SW_SHOW)

While 1

$Msg = GUIGetMsg()

Sleep(1000)

if $Msg -0 Then exit

if $Msg=$Start then Start()

WEnd

Func start()

$email=GUICtrlRead($input1)

msgbox (0, "read", "User Input is " & $email)

$number=GUICtrlRead($input2)

msgbox (0, "read", "User Input is " & $number)

While 1

$msg = GUIGetMsg(1)

Select

Case $msg[0] = $submit1

ExitLoop

Case $msg[0] = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED

$var1 = $J

Case $msg[0] = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED

$var1 = $U ;Or another var

EndSelect

WEnd

GUIDelete($gui1)

;Process result

$outlook = $var1

MsgBox(0,"Result",$outlook)

Exit

EndFunc

Edited by sparkymarky

Share this post


Link to post
Share on other sites
nitekram

is this what you are looking for?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

local $email, $number, $U = '2007', $J = '2003', $outlook, $submit1, $submit1, $gui1, $result,$var1


Opt("GUIOnEventMode",1)

$Form1_1 = GUICreate("Outlook emailer", 532, 231, 168, 124)

$input1 = GUICtrlCreateInput("Email", 24, 40, 481, 21)
$Label1 = GUICtrlCreateLabel("Enter Email address to send to:-", 16, 8, 193, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("How many messages to be sent", 8, 80, 195, 20)
$input2 = GUICtrlCreateInput("1", 24, 104, 73, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetLimit(-1, 3)

$radio1 = GUICtrlCreateRadio("Outlook 2003", 24, 152, 113, 17)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetState($radio1, $GUI_CHECKED)


$radio2 = GUICtrlCreateRadio("Outlook 2007", 24, 192, 113, 17)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

$Start = GUICtrlCreateButton("Start", 336, 168, 137, 41, $WS_GROUP)
GUICtrlSetOnEvent($Start,"start")

$filemenu = GUICtrlCreateMenu("File")
$fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
$separator1 = GUICtrlCreateMenuItem("", $filemenu)
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

GUISetState (@SW_SHOW)
While 1

$Msg = GUIGetMsg()
Sleep(1000)
if $Msg -0 Then exit
if $Msg=$Start then Start()
WEnd


Func start()
$email=GUICtrlRead($input1)
msgbox (0, "read", "User Input is " & $email)

$number=GUICtrlRead($input2)
msgbox (0, "read", "User Input is " & $number)

While 1
$msg = GUIGetMsg(1)
Select
Case $msg[0] = $submit1
ExitLoop



EndSelect
WEnd
Select
Case GUICtrlRead($radio1) = $GUI_CHECKED
$var1 = $J
Case GUICtrlRead($radio2) = $GUI_CHECKED
$var1 = $U ;Or another var
EndSelect

GUIDelete($gui1)
;Process result
$outlook = $var1
MsgBox(0,"Result",$outlook)



Exit

EndFunc

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites
sparkymarky

Thanks for everybody help,

I only using msgbox to check the return results is correct, then eventuality this be removed with varibles used be feed in the last section of code..

anyone cans see why I can selec]t a file, if user need to or not

emailer2.au3

Share this post


Link to post
Share on other sites
sparkymarky

Thanks for everybody help,

I only using msgbox to check the return results is correct, then eventuality this be removed with varibles used be feed in the last section of code..

anyone cans see why I can selec]t a file, if user need to or not

I forgot to mention it don't going to last abit of code, which is

Do

WinActivate("Inbox - Microsoft Outlook", "")

Send("^n") ; Ctrl N "for new email window"

WinActivate("Untitled - Message (Rich Text) ", "")

Send ($input1)

Send ("!" & $outlook) ; "Alt J" key pressed for subject box

Send ("Message" & $input2)

Send("!if") ; Alt I F keys " to open Attachment window "

WinWait("", "",5)

send ($fileitem)

;Send ("C:\Program Files\test.txt")

WinWait("", "", 5)

Send("{ENTER}")

Send("{ENTER}")

WinWait("", "", 5)

Send("^{ENTER}")

Sleep (1000 * $sec)

$x=$x+1

Until $x=$input2

MsgBox (0, "Message Sent", "Total of "& $x & " messages has been sent to " & $input1)

Exit

EndFunc

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  

×