Files
d3k/Settings.ahk
T

91 lines
2.9 KiB
AutoHotkey
Raw Normal View History

2026-08-28 12:18:25 -05:00
#Include "func.ahk"
2019-12-18 04:40:19 -06:00
;------------------------------------------------------------------------------
; Create GUI
;------------------------------------------------------------------------------
2026-08-28 12:18:25 -05:00
myGui := Gui()
myGui.Opt("-MaximizeBox -MinimizeBox") ; Remove the max+min buttons
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
myGui.Add("Edit", "w200 vEmail", settings["Email"]).OnEvent("LoseFocus", ProcessUserInput) ; settings["Email"]
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
myGui.Add("Text",, "Documentation file:") ; settings["DocFile"]
myGui.Add("Text",, settings["DocFile"])
myGui.Add("Button",, "Pick a different file").OnEvent("Click", DocSelect)
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
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)
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
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
}
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
myGui.Add("Checkbox", "vMsmv Checked" . msmv_check, "Mouse Mover: silently start on startup").OnEvent("Click", ProcessUserInput)
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
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")
2019-12-18 04:40:19 -06:00
Return
2026-08-28 12:18:25 -05:00
2019-12-18 04:40:19 -06:00
;------------------------------------------------------------------------------
; Edit ini
;------------------------------------------------------------------------------
2023-02-13 16:21:14 -06:00
2019-12-18 04:40:19 -06:00
/*
Default ini, sections are in []: (0 is off, 1 is on)
2020-01-14 08:36:51 -06:00
[email protected]
DocFile=Select File
2019-12-18 04:40:19 -06:00
JDProductNames=1
GloVar=0
German=0
*/
2026-08-28 12:18:25 -05:00
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")
}
}
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
DocSelect(*)
{
oSaved := myGui.Submit()
SelectedFile := FileSelect(3,, "Open a file", "Text Documents (*.txt)")
2023-02-13 16:21:14 -06:00
if !(SelectedFile)
2026-08-28 12:18:25 -05:00
MsgBox("You have not selected a file, this will break some things.")
2020-01-14 08:36:51 -06:00
else
2023-02-13 16:21:14 -06:00
ini_write(sett_ini, "DocFile", SelectedFile)
2026-08-28 12:18:25 -05:00
Run("Settings.ahk")
}
2019-12-18 04:40:19 -06:00
2026-08-28 12:18:25 -05:00
End(*)
{
ProcessUserInput()
ExitApp
}