lundi 20 septembre 2021

How to check if all checkboxes are unchecked? AHK

I need to check if all checkboxes are not selected, if all is unchecked do something. I managed to do it using if statement for all variables but i need a better solution instead of using the name of all variables because i prettend to add many more.

Thanks

#!s::
Gui, Destroy
gui, font, S12  ;Change font size to 12
Gui, Add, GroupBox, x0 w460 h180, Pesquisa: ;add a groupbox 
; gui, Add, Checkbox, x20 y30 checked1 vahk, AutoHotkey.com ;first checkbox and move down / over a bit
gui, Add, Checkbox, x20 y30 checked0 vstackBR, Pt.StackOverflow.com ;first checkbox and move down / over a bit
;gui, Add, Checkbox, checked0 vstackBR, Pt.StackOverflow.com
gui, Add, Checkbox, checked1 vstack, StackOverflow.com
gui, Add, Checkbox, checked1 vstackAHK, StackOverflow.com/AutoHotkey
gui, Add, Checkbox, checked0 vahk, AutoHotkey.com
gui, Add, Checkbox, checked0 vReddit,Reddit.com
Gui, Add, Checkbox, Checked0 Vtech,Techonthenet.Com
gui, Add, Text, x10 y+20, Pesquisar por:
gui, Add, Edit ,x+10 yp-5 w360  vSearchTerm 
gui, Add, Button, w82 gSearch Default, &Pesquisar

gui, Show 
GuiControl,Focus,SearchTerm
return

Search:
Gui Submit ;Needed to pull inf0 from controls

; if all checkboxes are not selected
if (stackBR=0 AND stackAHK=0 AND ahk=0 AND Reddit=0 AND tech=0)
    run "http://www.google.com/search?q=%SearchTerm%"

If stack 
    run "http://www.google.com/search?q=%SearchTerm%+site:stackoverflow.com"



Aucun commentaire:

Enregistrer un commentaire