AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Select Radio button & press Enter

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
badmojo



Joined: 11 Nov 2005
Posts: 141

PostPosted: Fri Jul 04, 2008 1:23 pm    Post subject: Select Radio button & press Enter Reply with quote

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
View user's profile Send private message
Red Hat Boy



Joined: 10 Apr 2008
Posts: 110

PostPosted: Fri Jul 04, 2008 9:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
badmojo



Joined: 11 Nov 2005
Posts: 141

PostPosted: Sat Jul 05, 2008 5:39 am    Post subject: Reply with quote

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
View user's profile Send private message
Red Hat Dude
Guest





PostPosted: Sat Jul 05, 2008 5:59 am    Post subject: Reply with quote

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





PostPosted: Sat Jul 05, 2008 6:05 am    Post subject: Reply with quote

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

PostPosted: Sat Jul 05, 2008 12:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Sat Jul 05, 2008 12:58 pm    Post subject: Reply with quote

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

PostPosted: Mon Jul 07, 2008 3:28 am    Post subject: Reply with quote

thanks, it works now! the 2nd loop took care of the variable assignment.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group