Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created October 23, 2020 15:05
Show Gist options
  • Save JoeGlines/28de407bb865930062104a045c510a0f to your computer and use it in GitHub Desktop.
Save JoeGlines/28de407bb865930062104a045c510a0f to your computer and use it in GitHub Desktop.
Adding a GUI to my search tool
;**************************************
;~ gui,+AlwaysOnTop
gui, font, S12 ;Change font size to 12
Gui, Add, GroupBox, x0 w460 h150, Search ;add a groupbox
gui, Add, Checkbox, x20 y30 checked1 vahk, AutoHotkey.com ;first checkbox and move down / over a bit
gui, Add, Checkbox, checked0 vstack, StackOverflow.com
gui, Add, Checkbox, checked1 vstackAHK, StackOverflow.com/AutoHotkey
gui, Add, Checkbox, checked0 vMicro,Microsoft.com
gui, Add, Checkbox, checked0 vTech,TechOntheNet.com
gui, Add, Text, x10 y+20, Search for:
gui, Add, Edit ,x+10 yp-5 w360 vSearchTerm
gui, Add, Button, w75 gSearch Default, &Search
gui, Add, Button, w75 x+25 gCancel Cancel, &Cancel
gui, font, S10 cblue ;Font size to 10 and color to blue
gui, Add, Checkbox, x300 yp+8 checked1 vquotes,Wrap Search in Double quotes ;Add check box to wrap in double quotes
gui, Show
GuiControl,Focus,SearchTerm
return
Search:
Gui Submit ;Needed to pull inf0 from controls
if quotes ;if selected, url enclude double quotes around search term
SearchTerm:="%22" SearchTerm "%22"
If ahk
run "http://www.google.com/search?q=%SearchTerm%+site:autohotkey.com"
If stack
run "http://www.google.com/search?q=%SearchTerm%+site:stackoverflow.com"
If stackAHK
run "http://www.google.com/search?q=%SearchTerm%+site:https://stackoverflow.com/questions/tagged/autohotkey"
If micro
run "http://www.google.com/search?q=%SearchTerm%+site:microsoft.com"
If tech
run "http://www.google.com/search?q=%SearchTerm%+site:techonthenet.com"
gui, hide
reload
return
Cancel:
gui, hide
return
Escape::ExitApp
@tandal
Copy link

tandal commented Oct 24, 2020

Thanks for sharing this @JoeGlines. I've just started to convert some of my scripts to the gui as well. I did fork this, and made a few additions and tweaks that you may like as well. Feel free to check out my modifications, there may be something there you want to incorporate into your own script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment