d3k/Settings.ahk

143 lines
4.0 KiB
AutoHotkey
Raw Normal View History

2019-12-18 04:40:19 -06:00
#Include, func.ahk
Menu, Tray, Icon, shell32.dll, 283
;------------------------------------------------------------------------------
; Read ini
;------------------------------------------------------------------------------
/*
2020-01-14 08:36:51 -06:00
This is the part that reads the file to see what your settings are. Variables in the ini file are in CamelCase, variables here are lowercase for more distinction
2019-12-18 04:40:19 -06:00
*/
; User Specific things:
2020-01-14 08:36:51 -06:00
racf := ini_getValue(ini, "USpec", "RACF")
email := ini_getValue(ini, "USpec", "Email")
docfile := ini_getValue(ini, "USpec", "DocFile")
2019-12-18 04:40:19 -06:00
; General Settings
2020-01-14 08:36:51 -06:00
mansol := ini_getValue(ini, "Main", "Mansol")
mjdpaste := ini_getValue(ini, "Main", "MJDPaste")
caseformatter := ini_getValue(ini, "Main", "CaseFormatter")
2019-12-18 04:40:19 -06:00
; Replacement
2020-01-14 08:36:51 -06:00
jdpn := ini_getValue(ini, "Replacement", "JDProductNames")
glovar := ini_getValue(ini, "Replacement", "GloVar")
2019-12-18 04:40:19 -06:00
; Language
2020-01-14 08:36:51 -06:00
ger := ini_getValue(ini, "Language", "German")
2019-12-18 04:40:19 -06:00
;------------------------------------------------------------------------------
; Create GUI
;------------------------------------------------------------------------------
2020-01-14 08:36:51 -06:00
Gui, -MaximizeBox -MinimizeBox ; Remove the max+min buttons
2019-12-18 04:40:19 -06:00
Gui, Add, GroupBox, x8 y2 w67 h37, RACF
Gui, Add, Edit, x12 y15 w60 h20 vformRACF gRACF, %RACF%
Gui, Add, GroupBox, x8 y40 w207 h37, Email Address
Gui, Add, Edit, x12 y53 w200 h20 vformEmail gEmail, %Email%
Gui, Add, GroupBox, x77 y2 w207 h37, Documentation File
Gui, Add, Text, x81 y19 w200 h20 gDocFile, %docfile%
Gui, Add, GroupBox, x8 y83 w107 h105, Main
Gui, Add, CheckBox, x12 y95 w100 h30 vformMansol Checked%mansol% gMansol, ManSol
Gui, Add, CheckBox, x12 y125 w100 h30 vformMJDPaste Checked%mjdpaste% gMJDPaste, MJDPaste
Gui, Add, CheckBox, x12 y155 w100 h30 vformCaseFormatter Checked%caseformatter% gCaseFormatter, Case Formatter
2020-01-14 10:05:02 -06:00
Gui, Add, GroupBox, x128 y83 w157 h75, Text Replacement
Gui, Add, CheckBox, x132 y95 w150 h30 vformJdpn Checked%jdpn% gJdpn, JD Product Names
Gui, Add, CheckBox, x132 y125 w150 h30 vformGlovar Checked%glovar% gGlovar, Global Variables
2019-12-18 04:40:19 -06:00
Gui, Add, CheckBox, x12 y187 w100 h30 vformGer Checked%ger% gGer, DE ([ as prefix)
2020-01-14 08:36:51 -06:00
Gui, Add, Button, x132 y190 w150 h23 gHelp, Click here for help (v%d3k_version%)
2019-12-18 04:40:19 -06:00
Gui, Show, h225 w295, David 3000 Settings
Return
;------------------------------------------------------------------------------
; Edit ini
;------------------------------------------------------------------------------
/*
Default ini, sections are in []:
[USpec]
RACF=LF01234
2020-01-14 08:36:51 -06:00
Email=LastnameFirstname@JohnDeere.com
2019-12-18 04:40:19 -06:00
DocFile=
[Main]
Mansol=1
MJDPaste=1
CaseFormatter=1
[Replacement]
JDProductNames=1
GloVar=0
[Language]
German=0
format for below:
Button G-label (executes when clicked):
Submit the gui so that it can change and don't hide it
write the state of the check box (a 0 for unchecked, 1 for checked), to the file at %ini%, section with this name, line with this name
*/
RACF:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "RACF", formRACF)
2019-12-18 04:40:19 -06:00
Return
Email:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "Email", formEmail)
2019-12-18 04:40:19 -06:00
Return
DocFile:
2020-01-14 08:36:51 -06:00
Gui, Submit
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt; *.doc)
if SelectedFile =
MsgBox, You have not selected a file, this will break some things.
else
ini_writeValue(ini, "DocFile", SelectedFile)
docfile := ini_getValue(ini, "USpec", "DocFile")
Gui, Show, h225 w295, David 3000 Settings
2019-12-18 04:40:19 -06:00
Return
Mansol:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "Mansol", formMansol)
2019-12-18 04:40:19 -06:00
Return
MJDPaste:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "MJDPaste", formMJDPaste)
2019-12-18 04:40:19 -06:00
Return
CaseFormatter:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "CaseFormatter", formCaseFormatter)
2019-12-18 04:40:19 -06:00
Return
Jdpn:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "JDProductNames", formJdpn)
2019-12-18 04:40:19 -06:00
Return
Glovar:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "GloVar", formGlovar)
2019-12-18 04:40:19 -06:00
Return
Ger:
2020-01-14 08:36:51 -06:00
Gui, Submit, NoHide
ini_writeValue(ini, "German", formGer)
Return
Help:
Gui, Submit
Run, https://daviddaily.dev/david/d3k/wiki
2019-12-18 04:40:19 -06:00
Return
GuiClose:
GuiEscape:
2020-01-14 08:36:51 -06:00
Run D3K.ahk
ExitApp ; Closes the app when escape or the exit button is pressed