update to new function

This commit is contained in:
David Daily 2023-02-13 16:21:14 -06:00
parent e10c04c253
commit d02ef808f8
1 changed files with 26 additions and 55 deletions

View File

@ -1,44 +1,17 @@
#Include, func.ahk #Include, func.ahk
#NoTrayIcon
Menu, Tray, Icon, shell32.dll, 283 Menu, Tray, Icon, shell32.dll, 283
;------------------------------------------------------------------------------
; Read ini
;------------------------------------------------------------------------------
/*
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
*/
; User Specific things:
racf := ini_get(ini, "USpec", "RACF")
email := ini_get(ini, "USpec", "Email")
docfile := ini_get(ini, "USpec", "DocFile")
; General Settings
mansol := ini_get(ini, "Main", "Mansol")
mjdpaste := ini_get(ini, "Main", "MJDPaste")
caseformatter := ini_get(ini, "Main", "CaseFormatter")
cfmail := ini_get(ini, "Main", "CFmail")
; Replacement
jdpn := ini_get(ini, "Replacement", "JDProductNames")
glovar := ini_get(ini, "Replacement", "GloVar")
; Language
ger := ini_get(ini, "Language", "German")
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Create GUI ; Create GUI
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
Gui, -MaximizeBox -MinimizeBox ; Remove the max+min buttons Gui, -MaximizeBox -MinimizeBox ; Remove the max+min buttons
Gui, Add, GroupBox, x8 y2 w67 h37, RACF Gui, Add, GroupBox, x8 y2 w193 h37, First Name
Gui, Add, Edit, x12 y15 w60 h20 vformRACF gRACF, %RACF% Gui, Add, Edit, x12 y15 w185 h20 vformName gName, %name%
Gui, Add, GroupBox, x8 y40 w207 h37, Email Address Gui, Add, GroupBox, x8 y40 w207 h37, Email Address
Gui, Add, Edit, x12 y53 w200 h20 vformEmail gEmail, %Email% 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 h130, Main Gui, Add, GroupBox, x8 y83 w107 h130, Main
Gui, Add, CheckBox, x12 y95 w100 h30 vformMansol Checked%mansol% gMansol, ManSol Gui, Add, CheckBox, x12 y95 w100 h30 vformMansol Checked%mansol% gMansol, ManSol
@ -46,25 +19,28 @@ Gui, Add, CheckBox, x12 y125 w100 h30 vformMJDPaste Checked%mjdpaste% gMJDPaste,
Gui, Add, CheckBox, x12 y155 w100 h30 vformCaseFormatter Checked%caseformatter% gCaseFormatter, Case Formatter 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 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 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%
Gui, Add, GroupBox, x128 y83 w157 h75, Text Replacement 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 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 y125 w150 h30 vformGlovar Checked%glovar% gGlovar, Global Variables
Gui, Add, CheckBox, x132 y155 w100 h30 vformGer Checked%ger% gGer, DE ([ as prefix) Gui, Add, CheckBox, x132 y155 w100 h30 vformGer Checked%ger% gGer, DE ([ as prefix)
Gui, Add, Link, x132 y190 w150 h23 gHelp, <a href="https://daviddaily.dev/david/d3k/wiki">Click here for help</a> (v%d3k_version%) Gui, Add, Link, x132 y190 w150 h26 gHelp, <a href="https://daviddaily.dev/david/d3k/wiki">Click here for help</a>`n%A_AhkVersion%
Gui, Show, h225 w295, David 3000 Settings Gui, Show, h273 w295, D3K version %d3k_version%
Return Return
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Edit ini ; Edit ini
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
/* /*
Default ini, sections are in []: (0 is off, 1 is on) Default ini, sections are in []: (0 is off, 1 is on)
[USpec] [USpec]
RACF=LF01234
Email=LastnameFirstname@JohnDeere.com Email=LastnameFirstname@JohnDeere.com
Name=Firstname
DocFile=Select File DocFile=Select File
[Main] [Main]
Mansol=1 Mansol=1
@ -77,69 +53,64 @@ GloVar=0
[Language] [Language]
German=0 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: Name:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "RACF", formRACF) ini_write(sett_ini, "Name", formName)
Return Return
Email: Email:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "Email", formEmail) ini_write(sett_ini, "Email", formEmail)
Return Return
DocFile: DocFile:
Gui, Submit Gui, Submit
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt; *.doc) FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt)
if SelectedFile = 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 else
ini_write(ini, "DocFile", SelectedFile) ini_write(sett_ini, "DocFile", SelectedFile)
docfile := ini_get(ini, "USpec", "DocFile") Run, Settings.ahk
Gui, Show, h225 w295, David 3000 Settings
Return Return
Mansol: Mansol:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "Mansol", formMansol) ini_write(sett_ini, "Mansol", formMansol)
Return Return
MJDPaste: MJDPaste:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "MJDPaste", formMJDPaste) ini_write(sett_ini, "MJDPaste", formMJDPaste)
Return Return
CaseFormatter: CaseFormatter:
Gui, Submit, NoHide Gui, Submit, NoHide
GuiControl, show%formCaseFormatter%, formCFmail ; only shows the check box for emails if the Case Formatter box is checked GuiControl, show%formCaseFormatter%, formCFmail ; only shows the check box for emails if the Case Formatter box is checked
GuiControl,, formCFmail, 0 GuiControl,, formCFmail, 0
ini_write(ini, "CaseFormatter", formCaseFormatter) ini_write(sett_ini, "CaseFormatter", formCaseFormatter)
ini_write(ini, "CFmail", "0") ; if you're toggling this, its either on or off, doesn't hurt to set it here ini_write(sett_ini, "CFmail", "0") ; if you're toggling this, its either on or off, doesn't hurt to set it here
Return Return
CFmail: CFmail:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "CFmail", formCFmail) ini_write(sett_ini, "CFmail", formCFmail)
Return Return
Jdpn: Jdpn:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "JDProductNames", formJdpn) ini_write(sett_ini, "JDProductNames", formJdpn)
Return Return
Glovar: Glovar:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "GloVar", formGlovar) ini_write(sett_ini, "GloVar", formGlovar)
Return Return
Ger: Ger:
Gui, Submit, NoHide Gui, Submit, NoHide
ini_write(ini, "German", formGer) ini_write(sett_ini, "German", formGer)
Return Return
Help: Help:
@ -149,4 +120,4 @@ Return
GuiClose: GuiClose:
GuiEscape: GuiEscape:
Run D3K.ahk Run D3K.ahk
ExitApp ; Closes the app when escape or the exit button is pressed ExitApp ; Closes the app when escape or the exit button is pressed