Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Need a windows with checkboxes that runs commands depending on what is checked


  • Please log in to reply
3 replies to this topic
thulsa18
  • Members
  • 11 posts
  • Last active: May 28 2014 11:35 AM
  • Joined: 12 Apr 2014

Hello Guys,

 

Sorry, I'm a absolute beginner, managed to get a menu working by editing someone elses script but thats about all I understand so far.

 

What I would like to have is a screen with checkboxes (similar to the inputbox) made by autohotkey, opened by choosing an option in a menu. And depending on which of the boxes are checked, it runs several commands afterwards.

 

What it is supposed to be for, there are several features that are all activated by specific commands. You can have either all, some or none of the features activated and I would like a checkbox systems where i select the features I want active and when I click ok, it runs all the commands to activate the selected features.

 

Hope that makes some sense and really hope that someone here can help me with that.



garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005

example with checkboxes and ini-file to save last settings

edit-field to input searchword and start selected internet search

Modified=20140412

SplitPath,a_scriptname, name, dir, ext, name_no_ext, drive
F1=%a_scriptdir%\%name_no_ext%.ini
I=10                 ;- total checkboxes

;src=Tan Soo Suan   ;- search for preselect
src=jim reeves
;src=rotterdam

Gui,2: Color, ControlColor, Black
Gui,2: Font, CDefault, Lucida Console


Loop,%i%
   {
   IniRead, Ch%A_Index%, %f1%, ss, Cb%A_Index% , 0
    If (Ch%A_Index% = 1)
       Cb%A_Index% = Checked
    Else
       Cb%A_Index% =
   }


Gui,2:  Show, x100 y5 w300 h440, %name_no_ext%

Gui,2: Add, Edit,      x20 y5  w265 h20 cWhite vSearch,%src%

Gui,2:  Add, CheckBox, x20 y40  vCh1  %cb1%   cYellow, Google
Gui,2:  Add, CheckBox, x20 y65  vCh2  %cb2%   cYellow, Google I``m feeling lucky
Gui,2:  Add, CheckBox, x20 y90  vCh3  %cb3%   cYellow, Bing   Pictures
Gui,2:  Add, CheckBox, x20 y115 vCh4  %cb4%   cYellow, Flickr Pictures
Gui,2:  Add, CheckBox, x20 y140 vCh5  %cb5%   cYellow, Google Pictures
Gui,2:  Add, CheckBox, x20 y165 vCh6  %cb6%   cYellow, Google News
Gui,2:  Add, CheckBox, x20 y190 vCh7  %cb7%   cYellow, Google News NL
Gui,2:  Add, CheckBox, x20 y215 vCh8  %cb8%   cYellow, Google Video
Gui,2:  Add, CheckBox, x20 y240 vCh9  %cb9%   cYellow, Google PDF
Gui,2:  Add, CheckBox, x20 y265 vCh10 %cb10%  cYellow, Wikipedia

Gui,2:  Add, CheckBox, x20 y330 vCh98 gCheckAll   cYellow, Select All
Gui,2:  Add, CheckBox, x20 y355 vCh99 gUnCheckAll cYellow, De-Select All

Gui,2:  Add, Button,   x10 y400 w100 h26 gAA ,Start
GuiControl,2:Focus,search
return


CheckAll:
Loop, %i%
    GuiControl,2:, Ch%A_Index%, 1
GuiControl,2:, Ch99, 0
Return

UnCheckAll:
Loop, %i%
    GuiControl,2:, Ch%A_Index%, 0
GuiControl,2:, Ch98, 0
Return


AA:
Gui,2: submit, nohide
StringReplace,Search, Search, %A_space%, +, All
search=`%22%search%`%22

  if Ch1
    run,http://www.google.de/search?hl=&q=%search%
  if Ch2
    run,http://www.google.com/search?btnI=I`%27m+Feeling+Lucky&q=%search%
  if Ch3
    run,http://www.bing.com/images/search?q=%search%&FORM=HDRSC2
  if Ch4
    run,https://www.flickr.com/search/?q=%search%
  if Ch5
    run,https://www.google.com/search?q=%search%&tbm=isch
  if Ch6
    run,https://www.google.com/search?q=%search%#q=%search%&tbm=nws
  if Ch7
    run,https://www.google.com/search?q=%search%#q=%search%&tbm=nws&hl=nl  ;- hl=nl nederlands
  if Ch8
    run,https://www.google.com/search?q=%search%#q=%search%&tbm=vid
  if Ch9
    run,http://www.google.de/search?hl=&q=%search% filetype:pdf
  if Ch10
     {
     StringReplace,search,search,+,%A_space%, All
     StringUpper,search,search,T
     StringReplace,search,search,%A_space%,_, All
     StringReplace,Search,Search,`%22, , All
     run, http://en.wikipedia.org/wiki/%search%
     }

return


2GuiClose:
Gui,2:  Submit
Loop,%i%
   {
   e= % ch%a_index%
   IniWrite, %e%, %f1%, ss, Cb%a_index%
   }
ExitApp
;===========================================================================




ErrorOnLine1
  • Members
  • 230 posts
  • Last active: Oct 05 2015 02:46 PM
  • Joined: 25 Dec 2012

Cool script, garry. I tested it by subbing Shakira for Jim Reeves and searching Google Pictures. Worked like a charm. Thanks a lot!



ErrorOnLine1
  • Members
  • 230 posts
  • Last active: Oct 05 2015 02:46 PM
  • Joined: 25 Dec 2012

 

example with checkboxes and ini-file to save last settings

edit-field to input searchword and start selected internet search


 

Hi garry, 
 
I had a bunch of links to music vids that I liked watching over and over. They were listed randomly in the draft folder of my mail program. The links were clickable when preview pane was enabled, but running the mail prog, enabling preview pane, then scrolling through the list was a pain. 
 
So, your search app has become VidRunner!   :D
 
It allows a new vid to be added to the playlist, then rebuilds the GUI to include the new vid. 
 
Here's what it looks like now ...