简体   繁体   中英

Working with Radio Buttons and GUI's

I've been learning to use GUI's with Autohotkey, and I'm creating a small script so when I press the insert button it allows me to quick search Google. I can't figure out how to use Radio Buttons, so say for example, I can choose to search Google or Bing. I don't know any of the code for "If Google is selected, search the query on Google".

^Insert::
MsgBox,4,, Would you like to reload?, 3

IfMsgBox, no
Return
IfMsgBox, Timeout
Return
Reload

Insert::
Gui, Add, Text,, Search Google:
Gui, Add, Edit, vSearchQuery ym  ; 
Gui, Add, Button, default, Search  
Gui, Show,, Quick Search
return


GuiClose:
ButtonSearch:
Gui, Submit  
Run, http://www.google.com/search?hl=en&q=%searchQuery% 
Reload

Here is a simple example:

Gui Add, Radio, vEngine, Google
Gui Add, Radio,, Bing
Gui Add, Button, h25 w126 Default,OK
Gui Show
Return

ButtonOK:
Gui Submit
if Engine = 1
    msgbox % "You chose Google!"    
else if Engine = 2
    msgbox % "You chose Bing!"
ExitApp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM