Skip to content

Instantly share code, notes, and snippets.

@psykzz
Created November 18, 2018 15:21
Show Gist options
  • Save psykzz/da8790e5b1026446af97c72e92f1b9a2 to your computer and use it in GitHub Desktop.
Save psykzz/da8790e5b1026446af97c72e92f1b9a2 to your computer and use it in GitHub Desktop.
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#notrayicon
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
versionnumber := 1.0
Gui, 1:Default
Gui +OwnDialogs
; Title and help text
Gui, Font, s14 Bold
Gui, Add, Text, x25 y10 +Center +wrap, Action Board
Gui, Font,
Gui, Font, s10 -Bold
Gui, Add, Text, x30 y+10 +Center +wrap, Right click boxes to set action, or to enable / disable buttons.
; First row desc
Gui, Font,
Gui, Add, Text, x25 w120 h20 +Center +wrap vdescription1,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription2,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription3,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription4,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription5,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription6,
; First row Buttons
Gui, Font, s14 Bold
Gui, Add, Button, x25 y+10 w120 h120 vbutton1 grunaction, 1
Gui, Add, Button, x+5 w120 h120 vbutton2 grunaction, 2
Gui, Add, Button, x+5 w120 h120 vbutton3 grunaction, 3
Gui, Add, Button, x+5 w120 h120 vbutton4 grunaction, 4
Gui, Add, Button, x+5 w120 h120 vbutton5 grunaction, 5
Gui, Add, Button, x+5 w120 h120 vbutton6 grunaction, 6
; Second row desc
Gui, Font,
Gui, Add, Text, x25 y+10 w120 h20 +Center +wrap vdescription7,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription8,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription9,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription10,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription11,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription12,
; Second row Buttons
Gui, Font, s14 Bold
Gui, Add, Button, x25 y+10 w120 h120 vbutton7 grunaction, 7
Gui, Add, Button, x+5 w120 h120 vbutton8 grunaction, 8
Gui, Add, Button, x+5 w120 h120 vbutton9 grunaction, 9
Gui, Add, Button, x+5 w120 h120 vbutton10 grunaction, 10
Gui, Add, Button, x+5 w120 h120 vbutton11 grunaction, 11
Gui, Add, Button, x+5 w120 h120 vbutton12 grunaction, 12
; Third row desc
Gui, Font,
Gui, Add, Text, x25 y+10 w120 h20 +Center +wrap vdescription13,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription14,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription15,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription16,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription17,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription18,
; Third row Buttons
Gui, Font, s14 Bold
Gui, Add, Button, x25 y+10 w120 h120 vbutton13 grunaction, 13
Gui, Add, Button, x+5 w120 h120 vbutton14 grunaction, 14
Gui, Add, Button, x+5 w120 h120 vbutton15 grunaction, 15
Gui, Add, Button, x+5 w120 h120 vbutton16 grunaction, 16
Gui, Add, Button, x+5 w120 h120 vbutton17 grunaction, 17
Gui, Add, Button, x+5 w120 h120 vbutton18 grunaction, 18
; Fourth row Desc
Gui, Font,
Gui, Add, Text, x25 y+10 w120 h20 +Center +wrap vdescription19,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription20,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription21,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription22,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription23,
Gui, Add, Text, x+5 w120 h20 +Center +wrap vdescription24,
; Fourth row Buttons
Gui, Font, s14 Bold
Gui, Add, Button, x25 y+10 w120 h120 vbutton19 grunaction, 19
Gui, Add, Button, x+5 w120 h120 vbutton20 grunaction, 20
Gui, Add, Button, x+5 w120 h120 vbutton21 grunaction, 21
Gui, Add, Button, x+5 w120 h120 vbutton22 grunaction, 22
Gui, Add, Button, x+5 w120 h120 vbutton23 grunaction, 23
Gui, Add, Button, x+5 w120 h120 vbutton24 grunaction, 24
Gui, Show, w800 h800 Center, Action Board by PsyKzz
loadfilesdescriptions:
loop, 24 ; This needs to loop for the total number of buttons
{
iniread, button%a_index%actionfile, settings.tsb, actionfiles, button%a_index%actionfile , %a_space%
if(button%a_index%actionfile = "error")
button%a_index%actionfile =
SplitPath, button%a_index%actionfile, tempfilename
guicontrol,, description%a_index%, %tempfilename%
iniread, disabletemp, settings.tsb, disabledbuttons, button%a_index%
if(disabletemp = "disabled")
GuiControl, Disable, button%a_index%
}
Menu, rightclick, Add, Associate Action, loadfile
Menu, rightclick, Add, Disable Button, disablebutton
Menu, rightclick, Add, Enable Button, enablebutton
Hotkey,ifwinactive, Action Board by PsyKzz
return
loadfile:
fileselectfile, %currentcontrol%actionfile, ,%A_ScriptDir%, Select new action file to load,
if ErrorLevel = 1
return
tempfilepath := %currentcontrol%actionfile
SplitPath, %currentcontrol%actionfile, tempfilename
guicontrol,, %currentdecription%, %tempfilename%
iniwrite, %tempfilepath%, settings.tsb, actionfiles, %currentcontrol%actionfile
return
disablebutton:
GuiControl, Disable, %currentcontrol%
iniwrite, disabled, settings.tsb, disabledbuttons, %currentcontrol%
return
enablebutton:
GuiControl, Enable, %currentcontrol%
inidelete, settings.tsb, disabledbuttons, %currentcontrol%
return
runaction:
currentcontrol := A_GuiControl
if(%currentcontrol%actionfile = "")
{
msgbox, No Action File Has been associated with this button. To link an action file to this button right click on the button and select 'Associate Action' From the dropdown menu.
return
}
currentactionfile := %currentcontrol%actionfile
Run, %comspec% /c %currentactionfile%
return
GuiContextMenu:
currentcontrol := A_GuiControl
loop, 20
{
if(currentcontrol = "button" . a_index)
{
currentdecription = description%a_index%
Menu, rightclick, Show, %A_GuiX%, %A_GuiY%
break
}
}
return
guiclose:
ExitApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment