Update Settings.ahk

This commit is contained in:
2026-08-28 12:18:25 -05:00
parent c9ef223131
commit 2129e733d1
+59 -91
View File
@@ -1,123 +1,91 @@
#Include, func.ahk
#NoTrayIcon
Menu, Tray, Icon, shell32.dll, 283
#Include "func.ahk"
;------------------------------------------------------------------------------
; Create GUI
;------------------------------------------------------------------------------
Gui, -MaximizeBox -MinimizeBox ; Remove the max+min buttons
myGui := Gui()
myGui.Opt("-MaximizeBox -MinimizeBox") ; Remove the max+min buttons
Gui, Add, GroupBox, x8 y2 w193 h37, First Name
Gui, Add, Edit, x12 y15 w185 h20 vformName gName, %name%
myGui.Add("Edit", "w200 vEmail", settings["Email"]).OnEvent("LoseFocus", ProcessUserInput) ; settings["Email"]
Gui, Add, GroupBox, x8 y40 w207 h37, Email Address
Gui, Add, Edit, x12 y53 w200 h20 vformEmail gEmail, %email%
myGui.Add("Text",, "Documentation file:") ; settings["DocFile"]
myGui.Add("Text",, settings["DocFile"])
myGui.Add("Button",, "Pick a different file").OnEvent("Click", DocSelect)
Gui, Add, GroupBox, x8 y83 w107 h130, 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
Gui, Add, CheckBox, x25 y178 w75 h30 vformCFmail Checked%cfmail% gCFmail, Email option
GuiControl, show%caseformatter%, formCFmail ; only shows the check box for emails if the Case Formatter box is checked
Gui, Add, GroupBox, x8 y215 w277 h50 vformDocFile, Documentation File
Gui, Add, Text, x15 y231 w260 h30 vformDocFile2 gDocFile, %docfile%
myGui.Add("Text", "Section", "Text Replacement")
myGui.Add("CheckBox", "vJDPN Checked" . settings["JDProductNames"], "JD Product Names").OnEvent("Click", ProcessUserInput)
myGui.Add("CheckBox", "vGloVar Checked" . settings["GloVar"], "Global Variables").OnEvent("Click", ProcessUserInput)
myGui.Add("CheckBox", "vDE Checked" . settings["German"], "DE ([ as prefix)").OnEvent("Click", ProcessUserInput)
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
Gui, Add, CheckBox, x132 y155 w100 h30 vformGer Checked%ger% gGer, DE ([ as prefix)
switch settings["msmv"] {
case "always-running": ; run at refresh of d3k, currently running
msmv_check := 1
case "always-stopped": ; run at refresh, currently stopped
msmv_check := 1
case "no-running": ; don't run at refresh, currently running
msmv_check := 0
case "no-stopped": ; don't run at refresh, currently stopped
msmv_check := 0
default:
MsgBox("Unexpected value `"" settings["msmv"] "`" in D3Ksettings.ini")
Reload
}
Gui, Add, Link, x132 y190 w150 h26 gHelp, <a href="https://daviddaily.dev/david/d3k/wiki">Click here for help</a>`n%A_AhkVersion%
myGui.Add("Checkbox", "vMsmv Checked" . msmv_check, "Mouse Mover: silently start on startup").OnEvent("Click", ProcessUserInput)
Gui, Show, h273 w295, D3K version %d3k_version%
myGui.Add("Link",, "<a href=`"https://daviddaily.dev/david/d3k/wiki`">Click here for help</a>")
myGui.Add("Text",, "AHK Version: " . A_AhkVersion)
myGui.Add("Text",, "D3K version " . d3k_version)
myGui.Title := "D3K settings"
MyGui.OnEvent("Close", ProcessUserInput)
myGui.OnEvent("Escape", End)
myGui.Show("AutoSize")
Return
;------------------------------------------------------------------------------
; Edit ini
;------------------------------------------------------------------------------
/*
Default ini, sections are in []: (0 is off, 1 is on)
[USpec]
[email protected]
Name=Firstname
DocFile=Select File
[Main]
Mansol=1
MJDPaste=1
CaseFormatter=1
CFmail=0
[Replacement]
JDProductNames=1
GloVar=0
[Language]
German=0
*/
Name:
Gui, Submit, NoHide
ini_write(sett_ini, "Name", formName)
Return
Email:
Gui, Submit, NoHide
ini_write(sett_ini, "Email", formEmail)
Return
ProcessUserInput(*)
{
Saved := MyGui.Submit(0) ; Save the contents of named controls into an object.
ini_write(sett_ini, "Email", Saved.Email)
ini_write(sett_ini, "JDProductNames", Saved.JDPN)
ini_write(sett_ini, "GloVar", Saved.GloVar)
ini_write(sett_ini, "German", Saved.DE)
if (Saved.Msmv = 1)
{
ini_write(sett_ini, "msmv", "always-stopped")
} else {
ini_write(sett_ini, "msmv", "no-stopped")
}
}
DocFile:
Gui, Submit
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt)
DocSelect(*)
{
oSaved := myGui.Submit()
SelectedFile := FileSelect(3,, "Open a file", "Text Documents (*.txt)")
if !(SelectedFile)
MsgBox, You have not selected a file, this will break some things.
MsgBox("You have not selected a file, this will break some things.")
else
ini_write(sett_ini, "DocFile", SelectedFile)
Run, Settings.ahk
Return
Run("Settings.ahk")
}
Mansol:
Gui, Submit, NoHide
ini_write(sett_ini, "Mansol", formMansol)
Return
MJDPaste:
Gui, Submit, NoHide
ini_write(sett_ini, "MJDPaste", formMJDPaste)
Return
CaseFormatter:
Gui, Submit, NoHide
GuiControl, show%formCaseFormatter%, formCFmail ; only shows the check box for emails if the Case Formatter box is checked
GuiControl,, formCFmail, 0
ini_write(sett_ini, "CaseFormatter", formCaseFormatter)
ini_write(sett_ini, "CFmail", "0") ; if you're toggling this, its either on or off, doesn't hurt to set it here
Return
CFmail:
Gui, Submit, NoHide
ini_write(sett_ini, "CFmail", formCFmail)
Return
Jdpn:
Gui, Submit, NoHide
ini_write(sett_ini, "JDProductNames", formJdpn)
Return
Glovar:
Gui, Submit, NoHide
ini_write(sett_ini, "GloVar", formGlovar)
Return
Ger:
Gui, Submit, NoHide
ini_write(sett_ini, "German", formGer)
Return
Help:
Gui, Submit
Return
GuiClose:
GuiEscape:
Run D3K.ahk
ExitApp ; Closes the app when escape or the exit button is pressed
End(*)
{
ProcessUserInput()
ExitApp
}