 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
badmojo
Joined: 11 Nov 2005 Posts: 141
|
Posted: Fri Jul 04, 2008 1:23 pm Post subject: Select Radio button & press Enter |
|
|
i'm having trouble with this code here. i'm trying to select a radio button and press 'Enter' to run a program with radio button's caption as the parameter. but i'm not sure how to retrieve the selected radio button's caption as a variable. some pointers would be nice.
| Code: | ; Select Radio button & press Enter
Loop, 5
{
;Gui, Add, Radio, gRunThis , Episode %A_Index%
Gui, Add, Radio, , Episode %A_Index%
}
Gui, Add, Button, gRunThis, Play
Gui, Show, Center
Return
RunThis:
Gui, Submit, NoHide
;need some code to retrieve the selected radio box
;Run program
Return |
|
|
| Back to top |
|
 |
Red Hat Boy
Joined: 10 Apr 2008 Posts: 110
|
Posted: Fri Jul 04, 2008 9:12 pm Post subject: |
|
|
| Code: | ; Select Radio button & press Enter
Loop, 5
{
Gui, Add, Radio, vMyRadio, Episode %A_Index%
Gui, Add, Radio, , Episode %A_Index%
}
Gui, Add, Button, gRunThis, Play
Gui, Show, Center
Return
RunThis:
Gui, Submit, NoHide
if MyRadio = 1
Msgbox Radio is 1
else if MyRadio = 2
Msgbox Do other stuff...
;Run program
Return |
Happy boom-boom day. _________________ I slit the sheet, the sheet I slit,
and on the slitted sheet I sit. ;~} |
|
| Back to top |
|
 |
badmojo
Joined: 11 Nov 2005 Posts: 141
|
Posted: Sat Jul 05, 2008 5:39 am Post subject: |
|
|
| i'd already tried that but the following error appeared: "The same variable cannot be used for more than one control". that's why i'm wondering instead of a loop should i just add the button repeatedly, each with different variables? |
|
| Back to top |
|
 |
Red Hat Dude Guest
|
Posted: Sat Jul 05, 2008 5:59 am Post subject: |
|
|
| Code: | Gui, Add, Radio, vMyRadio%A_Index%, Episode %A_Index%
Gui, Add, Radio, , Episode %A_Index% |
?
Lemme know how it works out. |
|
| Back to top |
|
 |
Red Hat Dude Guest
|
Posted: Sat Jul 05, 2008 6:05 am Post subject: |
|
|
| Code: | Gui, Add, Radio, vMyRadio, Episode %A_Index%
Gui, Add, Radio, , Episode %A_Index%
Loop, 4
{
Gui, Add, Radio, , Episode %A_Index%
Gui, Add, Radio, , Episode %A_Index% ; Why are there two of these? I don't know.
} |
|
|
| Back to top |
|
 |
badmojo
Joined: 11 Nov 2005 Posts: 141
|
Posted: Sat Jul 05, 2008 12:52 pm Post subject: |
|
|
| Red Hat Dude wrote: | | Code: | Gui, Add, Radio, vMyRadio%A_Index%, Episode %A_Index%
Gui, Add, Radio, , Episode %A_Index% |
?
Lemme know how it works out. |
this also doesn't work as it adds two of each caption, ending up with 10 radio buttons. |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Jul 05, 2008 12:58 pm Post subject: |
|
|
| Code: | Loop, 5
Gui, Add, Radio, vEpisode%A_Index% , Episode %A_Index%
Gui, Add, Button, Default gRunThis, Play
Gui, Show, Center
Return
RunThis:
Gui, Submit, NoHide
Loop, 5
{
If (Episode%A_Index%=1)
{
Checked := A_Index
break
}
}
Tooltip, You've checked %Checked%
Return |
|
|
| Back to top |
|
 |
badmojo
Joined: 11 Nov 2005 Posts: 141
|
Posted: Mon Jul 07, 2008 3:28 am Post subject: |
|
|
| thanks, it works now! the 2nd loop took care of the variable assignment. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|