Re: Check all or clear all checkboxes
Posted: 13 Dec 2018, 08:54
Yeah, i've seen it.... the 2nd } was giving the problem right?
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=59216
Code: Select all
; Registers.ahk
Registers() {
new Menu.Page(Title := "Registers", "Start_Registers")
.AddCheckbox( 1, "Delete_people_icon", "Delete icon -> People <- from taskbar")
.AddCheckbox( 1, "Folder_options", "Change folder options (unhide and see ext.)")
return Title
}
Start_Registers() {
global
Gui, Submit, NoHide
if Delete_people_icon = 1
Delete_people_icon()
if Folder_options = 1
Folder_options()
}
Delete_people_icon() {
;~ RegWrite, REG_DWORD, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People , PeopleBand, 00000000
CoordMode, ToolTip
ToolTip , just a second and wait till every script is loaded... Deleting people icon from the taskbar..., 0, 20, WhichToolTip
Sleep, 1000
ToolTip
}
Folder_options() {
;~ RegWrite, REG_DWORD, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer, ShowRecent, 00000000
CoordMode, ToolTip
ToolTip , just a second and wait till every script is loaded... Opties voor verkenner zijn ingesteld zoals het zien van verborgen bestanden en extenties verbergen..., 0, 20, WhichToolTip
Sleep, 1000
ToolTip
}
Code: Select all
AddText(ByRef Box) { ; populate tab with text
local pos := (Box[3] & 1) ; flip even/odd
? "yp x" this.Tab_Width // 2 ; 2, 4, 6, 8, ...
: "y+3 xs" ; 1, 3, 5, 7, ...
Gui, Add, Text, % pos Box[1], % Box[2]
}
Code: Select all
#NoEnv
#SingleInstance Force
new Menu("Test Installation Menu -= December 2018 - September 2019 =-")
.Layout("Programs")
.Tab_Size(900, 700)
.Show(400, 50)
return ; end of auto-execute section
GuiClose:
ExitApp
class Menu { ; handles "Select XXX" buttons and colors
;{ Class variables };
static Children := {} ;}
;{ Instance variables };
Tab_Width := A_ScreenWidth // 2
Tab_Height := A_ScreenHeight // 2
Tab_List := "" ;}
__New(WinTitle) { ; constructor
Gui, Menu: New, LabelGui, %WinTitle%
}
Layout(args*) { ; configure
Loop, % args.length() ; FName = also name of #Include-files
FName := args[A_Index], _List .= "|" %FName%()
this.Tab_List := LTrim(_List, "|")
return this ; chain
}
Tab_Size(w, h) { ; configure
this.Tab_Width := w
this.Tab_Height := h
return this ; chain
}
AddCheckbox(ByRef Box) { ; populate tab in 2 columns
;-----------------------------------
local pos := (Box[4] & 1) ; flip even/odd
? "yp x" this.Tab_Width // 2 ; 2, 4, 6, 8, ...
: "y+3 xs" ; 1, 3, 5, 7, ...
local Color := Box[1] ? "Green Checked" : "Red"
local VarName := Box[2]
local Box_onClick := this.toggleColour.Bind(this)
Gui, Add, Checkbox, %pos% c%Color% v%VarName%, % Box[3]
GuiControl +g, %VarName%, % Box_onClick
}
toggleColour(hWnd) { ; all the Checkboxes come here for colouring
GuiControlGet, State,, %hWnd%
GuiControl, % "+c" (State ? "Green" : "Red"), %hWnd%
}
AddTab(i, ByRef Child) { ; populate Tab2 with child-pages
;-----------------------------------
Gui, Tab, %i%
if (Child.Boxes.Length()) { ; add buttons
Gui, Add, Button, HWNDhAll Section, Select All
Gui, Add, Button, HWNDhNone x+m, Select None
SelectAll_onClick := this.SelectAll.Bind(this)
SelectNone_onClick := this.SelectNone.Bind(this)
GuiControl +g, %hAll%, % SelectAll_onClick
GuiControl +g, %hNone%, % SelectNone_onClick
} else
Gui, Add, Text, w0 h0 Section, dummy
for each, CBox in Child.Boxes
this.AddCheckbox(CBox)
for each, TBox in Child.Texts
this.AddText(TBox)
if (Child.Callback) {
Gui, Add, Button, HWNDhCtrl xs, Start
Start_onClick := Func(Child.Callback).Bind(this)
GuiControl +g, %hCtrl%, % Start_onClick
}
}
SelectAll() { ; all the "Select All" buttons come here
;-----------------------------------
GuiControlGet, Tab_Name,, SysTabControl321
for each, Child in Menu.Children
if (Child.Title = Tab_Name)
break
for each, VarName in Child.VarNames {
GuiControl,, %VarName%, 1
GuiControl, +cGreen, %VarName%
}
}
SelectNone() { ; all the "Select None" buttons come here
;-----------------------------------
GuiControlGet, Tab_Name,, SysTabControl321
for each, Child in Menu.Children
if (Child.Title = Tab_Name)
break
for each, VarName in Child.VarNames {
GuiControl,, %VarName%, 0
GuiControl, +cRed, %VarName%
}
}
Show(x := "Center", y := "Center") { ; create & show GUI
;-----------------------------------
w := this.Tab_Width, h := this.Tab_Height
Gui, Add, Tab2, w%w% h%h%, % this.Tab_List
Gui, Font, s10, Verdana
for i, Child in this.Children ; iterate through tabs
this.AddTab(i, Child)
; Gui, Show, x%x% y%y%
Gui, Show, center
}
class Page { ; contains various controls, and an optional Start button
;{ Instance variables };
Title := "" ; Tab title
CallBack := "" ; Start button
VarNames := [] ; collection
Boxes := [] ; Checkbox controls
Texts := [] ;} Text controls
__New(Title, CallBack := "") { ; constructor
this.Title := Title
this.CallBack := CallBack
Menu.Children.Push(this)
}
AddCheckbox(Flag, VarName, Text) { ; register
this.VarNames.Push(VarName)
this.Boxes.Push([Flag, VarName, Text, this.Boxes.Length()])
return this ; chain
}
AddText(Options, Text) { ; register
this.Texts.Push([Options, Text, this.Texts.Length()])
return this ; chain
}
}
}
Programs() {
new Menu.Page(Title := "Installation and shortcuts", "Start_Programs")
.AddCheckbox( 0, "wnetwatcher", "Wireless Network Watcher (1Mb)")
.AddCheckbox( 0, "ammyy", "Ammyy (1Mb)")
.AddCheckbox( 0, "rufus", "Rufus (2Mb)")
.AddCheckbox( 0, "ultraviewer", "Ultraviewer 6.2 (3Mb)")
.AddCheckbox( 0, "PartitionWizard11", "MiniTool Partition Wizard 11 (30Mb)")
.AddCheckbox( 0, "chromeportable", "Portable Chrome (70Mb)")
.AddCheckbox( 0, "EpsonXP630", "* Drivers - Epson XP-630 (64Mb)")
return Title
}
Start_Programs() {
global
Gui, Submit, NoHide
if wnetwatcher = 1
{
; start something
}
if chromeportable = 1
{
; start something
}
if rufus = 1
{
; start something
}
if ammyy = 1
{
; start something
}
if ultraviewer = 1
{
; start something
}
if EpsonXP630 = 1
{
; start something
}
if PartitionWizard11 = 1
{
; start something
}
}
return
Code: Select all
Programs() {
new Menu.Page(Title := "Installation and shortcuts", "Start_Programs")
.AddCheckbox( 0, "wnetwatcher", "Wireless Network Watcher (1Mb)")
.AddCheckbox( 0, "ammyy", "Ammyy (1Mb)")
.AddCheckbox( 0, "rufus", "Rufus (2Mb)")
.AddCheckbox( 0, "ultraviewer", "Ultraviewer 6.2 (3Mb)")
.AddCheckbox( 0, "PartitionWizard11", "MiniTool Partition Wizard 11 (30Mb)")
.AddCheckbox( 0, "_", "_______________________")
.AddCheckbox( 0, "EpsonXP630", "* Drivers - Epson XP-630 (64Mb)")
.AddCheckbox( 0, "chromeportable", "Portable Chrome (70Mb)")
return Title
}
Code: Select all
#NoEnv
#SingleInstance Force
new Menu("DONT WORRY ALL SCRIPTS ARE DISABLED")
.Layout( "Advanced_Registry")
.Tab_Size(1100, 700)
.Show(400, 50)
return ; end of auto-execute section
GuiClose:
ExitApp
class Menu { ; handles "Select XXX" buttons and colors
;{ Class variables };
static Children := {} ;}
;{ Instance variables };
Tab_Width := A_ScreenWidth // 2
Tab_Height := A_ScreenHeight // 2
Tab_List := "" ;}
__New(WinTitle) { ; constructor
Gui, Menu: New, LabelGui, %WinTitle%
}
Layout(args*) { ; configure
Loop, % args.length() ; FName = also name of #Include-files
FName := args[A_Index], _List .= "|" %FName%()
this.Tab_List := LTrim(_List, "|")
return this ; chain
}
Tab_Size(w, h) { ; configure
this.Tab_Width := w
this.Tab_Height := h
return this ; chain
}
AddText(ByRef Box) { ; populate tab with text
local pos := (Box[3] & 1) ; flip even/odd
? "yp x" this.Tab_Width // 2 ; 2, 4, 6, 8, ...
: "y+3 xs" ; 1, 3, 5, 7, ...
Gui, Add, Text, % pos Box[1], % Box[2]
}
AddCheckbox(ByRef Box) { ; populate tab in 2 columns
local pos := (Box[4] & 1) ; flip even/odd
? "yp x" this.Tab_Width // 2 ; 2, 4, 6, 8, ...
: "y+3 xs" ; 1, 3, 5, 7, ...
local Color := Box[1] ? "Green Checked" : "Red"
local VarName := Box[2]
local Box_onClick := this.toggleColour.Bind(this)
Gui, Add, Checkbox, %pos% c%Color% v%VarName%, % Box[3]
GuiControl +g, %VarName%, % Box_onClick
}
toggleColour(hWnd) { ; all the Checkboxes come here for colouring
GuiControlGet, State,, %hWnd%
GuiControl, % "+c" (State ? "Green" : "Red"), %hWnd%
}
AddTab(i, ByRef Child) { ; populate Tab2 with child-pages
Gui, Tab, %i%
if (Child.Boxes.Length()) { ; add buttons
Gui, Add, Button, HWNDhAll Section, Select All
Gui, Add, Button, HWNDhNone x+m, Select None
SelectAll_onClick := this.SelectAll.Bind(this)
SelectNone_onClick := this.SelectNone.Bind(this)
GuiControl +g, %hAll%, % SelectAll_onClick
GuiControl +g, %hNone%, % SelectNone_onClick
} else
Gui, Add, Text, w0 h0 Section, dummy
for each, CBox in Child.Boxes
this.AddCheckbox(CBox)
for each, TBox in Child.Texts
this.AddText(TBox)
if (Child.Callback) {
Gui, Add, Button, HWNDhCtrl xs, Start
Start_onClick := Func(Child.Callback).Bind(this)
GuiControl +g, %hCtrl%, % Start_onClick
}
}
SelectAll() { ; all the "Select All" buttons come here
;-----------------------------------
GuiControlGet, Tab_Name,, SysTabControl321
for each, Child in Menu.Children
if (Child.Title = Tab_Name)
break
for each, VarName in Child.VarNames {
GuiControl,, %VarName%, 1
GuiControl, +cGreen, %VarName%
}
}
SelectNone() { ; all the "Select None" buttons come here
;-----------------------------------
GuiControlGet, Tab_Name,, SysTabControl321
for each, Child in Menu.Children
if (Child.Title = Tab_Name)
break
for each, VarName in Child.VarNames {
GuiControl,, %VarName%, 0
GuiControl, +cRed, %VarName%
}
}
Show(x := "Center", y := "Center") { ; create & show GUI
w := this.Tab_Width, h := this.Tab_Height
Gui, Add, Tab2, w%w% h%h%, % this.Tab_List
Gui, Font, s10, Arial
for i, Child in this.Children ; iterate through tabs
this.AddTab(i, Child)
Gui, Show, center
}
class Page { ; contains various controls, and an optional Start button
;{ Instance variables };
Title := "" ; Tab title
CallBack := "" ; Start button
VarNames := [] ; collection
Boxes := [] ; Checkbox controls
Texts := [] ;} Text controls
__New(Title, CallBack := "") { ; constructor
this.Title := Title
this.CallBack := CallBack
Menu.Children.Push(this)
}
AddCheckbox(Flag, VarName, Text) { ; register
this.VarNames.Push(VarName)
this.Boxes.Push([Flag, VarName, Text, this.Boxes.Length()])
return this ; chain
}
AddText(Options, Text) { ; register
this.Texts.Push([Options, Text, this.Texts.Length()])
return this ; chain
}
}
}
Advanced_Registry() {
new Menu.Page(Title := "• Registry", "Start_Advanced_Registry")
.AddCheckbox( 1, "SearchboxTaskbarMode", "Disable search bar on taskbar")
.AddCheckbox( 1, "Remove_intel_context_menu", "Remove Intel entries from context menu")
.AddCheckbox( 1, "Disable_grouping", "Disable grouping with open windows on taskbar")
.AddCheckbox( 1, "kleuren_en_afstanden_en_tranparanties_1", "DPI FIX - No blurry fonts anymore")
.AddCheckbox( 1, "Update_context_menu", "Add Update at the top off context menu")
.AddCheckbox( 1, "Remove_shortcut_arrow", "Remove shortcut arrow from desktop")
.AddCheckbox( 0, "Icon_distance", "Shorten distance between icons on desktop")
.AddCheckbox( 0, "kleuren_afstanden_tranparanties", "Change color active and inactive windows")
.AddCheckbox( 0, "DisableShowTaskViewButton", "Disable Taskview Button")
.AddCheckbox( 0, "Snelle_toegang", "Personal Quick Access on the left window panel")
return Title
}
Start_Advanced_Registry() {
global
Gui, Submit, NoHide
if SearchboxTaskbarMode = 1
{
MsgBox Just for testing
}
if Remove_intel_context_menu = 1
{
MsgBox Just for testing
}
if Disable_grouping = 1
{
MsgBox Just for testing
}
if kleuren_en_afstanden_en_tranparanties_1 = 1
{
MsgBox Just for testing
}
if Update_context_menu = 1
{
MsgBox Just for testing
}
if Remove_shortcut_arrow = 1
{
MsgBox Just for testing
}
if Icon_distance = 1
{
MsgBox Just for testing
}
if DisableShowTaskViewButton = 1
{
MsgBox Just for testing
}
if kleuren_afstanden_tranparanties = 1
{
MsgBox Just for testing
}
if Snelle_toegang = 1
{
MsgBox Just for testing
}
}
return