Update 'Settings.ahk'

This commit is contained in:
David Daily 2020-01-14 08:36:51 -06:00
parent 814167dffa
commit 8e71ac1510

View File

@ -9,31 +9,34 @@ Menu, Tray, Icon, shell32.dll, 283
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
ini = %A_MyDocuments%\D3Ksettings.ini ini = %A_MyDocuments%\D3Ksettings.ini
/* /*
This is the part that reads the file to see what your settings are. Variables in the ini file are in all lowercase, variables here are CamelCase for more distinction 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: ; User Specific things:
IniRead, racf, %ini%, USpec, RACF racf := ini_getValue(ini, "USpec", "RACF")
IniRead, email, %ini%, USpec, Email email := ini_getValue(ini, "USpec", "Email")
IniRead, docfile, %ini%, USpec, DocFile docfile := ini_getValue(ini, "USpec", "DocFile")
; General Settings ; General Settings
IniRead, mansol, %ini%, Main, Mansol mansol := ini_getValue(ini, "Main", "Mansol")
IniRead, mjdpaste, %ini%, Main, MJDPaste mjdpaste := ini_getValue(ini, "Main", "MJDPaste")
IniRead, caseformatter, %ini%, Main, CaseFormatter caseformatter := ini_getValue(ini, "Main", "CaseFormatter")
; Replacement ; Replacement
IniRead, symb, %ini%, Replacement, Symbols jdpn := ini_getValue(ini, "Replacement", "JDProductNames")
IniRead, jdpn, %ini%, Replacement, JDProductNames glovar := ini_getValue(ini, "Replacement", "GloVar")
IniRead, glovar, %ini%, Replacement, GloVar
; Language ; Language
IniRead, ger, %ini%, Language, German ger := ini_getValue(ini, "Language", "German")
; Info
d3k_version := ini_getValue(ini, "Info", "Version")
d3k_version := RTrim(d3k_version, "0") ; it was returning the value with appended zeroes, that's not neccesary.
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Create GUI ; Create GUI
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
Gui, -MaximizeBox -MinimizeBox +E0x00000400 ; Remove the max+min buttons, add the Help questionmark Gui, -MaximizeBox -MinimizeBox ; Remove the max+min buttons
Gui, Add, GroupBox, x8 y2 w67 h37, RACF Gui, Add, GroupBox, x8 y2 w67 h37, RACF
Gui, Add, Edit, x12 y15 w60 h20 vformRACF gRACF, %RACF% Gui, Add, Edit, x12 y15 w60 h20 vformRACF gRACF, %RACF%
@ -55,17 +58,11 @@ Gui, Add, CheckBox, x132 y125 w150 h30 vformJdpn Checked%jdpn% gJdpn, JD Product
Gui, Add, CheckBox, x132 y155 w150 h30 vformGlovar Checked%glovar% gGlovar, Global Variables Gui, Add, CheckBox, x132 y155 w150 h30 vformGlovar Checked%glovar% gGlovar, Global Variables
Gui, Add, CheckBox, x12 y187 w100 h30 vformGer Checked%ger% gGer, DE ([ as prefix) Gui, Add, CheckBox, x12 y187 w100 h30 vformGer Checked%ger% gGer, DE ([ as prefix)
Gui, Add, Button, x132 y190 w150 h23 gHelp, Click here for help (v%d3k_version%)
Gui, Add, Text, x237 y203 w100 h20, %d3k_version%
Gui, Show, h225 w295, David 3000 Settings Gui, Show, h225 w295, David 3000 Settings
OnMessage(0x0053, "Help") ; Goes to the Help() function when you click after pressing the help button
Return Return
; All Help stuff is functions, INI writing is labels
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Edit ini ; Edit ini
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -74,14 +71,13 @@ Default ini, sections are in []:
[USpec] [USpec]
RACF=LF01234 RACF=LF01234
Email=LastnameFirstname@example.com Email=LastnameFirstname@JohnDeere.com
DocFile= DocFile=
[Main] [Main]
Mansol=1 Mansol=1
MJDPaste=1 MJDPaste=1
CaseFormatter=1 CaseFormatter=1
[Replacement] [Replacement]
Symbols=1
JDProductNames=1 JDProductNames=1
GloVar=0 GloVar=0
[Language] [Language]
@ -94,170 +90,65 @@ format for below:
Button G-label (executes when clicked): Button G-label (executes when clicked):
Submit the gui so that it can change and don't hide it 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 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: RACF:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formRACF%, %ini%, USpec, RACF ini_writeValue(ini, "RACF", formRACF)
Return Return
Email: Email:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formEmail%, %ini%, USpec, Email ini_writeValue(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; *.doc)
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
IniWrite, %SelectedFile%, %ini%, USpec, DocFile ini_writeValue(ini, "DocFile", SelectedFile)
IniRead, docfile, %ini%, USpec, DocFile docfile := ini_getValue(ini, "USpec", "DocFile")
Gui, Show, h225 w295, David 3000 Settings Gui, Show, h225 w295, David 3000 Settings
OnMessage(0x0053, "Help") ; Goes to the Help() function when you click after pressing the help button
Return Return
Mansol: Mansol:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formMansol%, %ini%, Main, Mansol ini_writeValue(ini, "Mansol", formMansol)
Return Return
MJDPaste: MJDPaste:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formMJDPaste%, %ini%, Main, MJDPaste ini_writeValue(ini, "MJDPaste", formMJDPaste)
Return Return
CaseFormatter: CaseFormatter:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formCaseFormatter%, %ini%, Main, CaseFormatter ini_writeValue(ini, "CaseFormatter", formCaseFormatter)
Return
Symb:
Gui, Submit, NoHide
IniWrite, %formSymb%, %ini%, Replacement, Symbols
Return Return
Jdpn: Jdpn:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formJdpn%, %ini%, Replacement, JDProductNames ini_writeValue(ini, "JDProductNames", formJdpn)
Return Return
Glovar: Glovar:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formGlovar%, %ini%, Replacement, GloVar ini_writeValue(ini, "GloVar", formGlovar)
Return Return
Ger: Ger:
Gui, Submit, NoHide Gui, Submit, NoHide
IniWrite, %formGer%, %ini%, Language, German ini_writeValue(ini, "German", formGer)
Return
Help:
Gui, Submit
Run, https://daviddaily.dev/david/d3k/wiki
Return 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
;------------------------------------------------------------------------------
; Help, should replace reading the Readme eventually
;------------------------------------------------------------------------------
Help()
{
mousegetpos,,,, name
If RegExMatch(name, "Button1$")
RACF()
Else If InStr(name, "Edit1")
RACF()
Else If InStr(name, "Button2")
Email()
Else If InStr(name, "Edit2")
Email()
Else If InStr(name, "Button3")
DocFile()
Else If InStr(name, "Static1")
DocFile()
Else If InStr(name, "Button4")
Mansol()
Else If InStr(name, "Button5")
Mansol()
Else If InStr(name, "Button6")
MJDPaste()
Else If InStr(name, "Button7")
CaseFormatter()
Else If InStr(name, "Button8")
Symb()
Else If InStr(name, "Button9")
Symb()
Else If InStr(name, "Button10")
Jdpn()
Else If InStr(name, "Button11")
Glovar()
Else If InStr(name, "Button12")
Ger()
Else
Return
}
; 262176 for just the question mark and always on top
; 278560 adds a help button
RACF()
{
MsgBox, 262176, RACF, Typing ]me or [me will replace it with your RACF as you put it here
}
Email()
{
MsgBox, 262176, Email, Typing @me or @me will replace it with your email as you put it here.`n]email`tEmail templateish thing`n]97010`tSend them to DTAC`n]2yc`t2 Year old COMAR rule
}
DocFile()
{
MsgBox, 262176, Documentation File, The location of the file where you are doing your documentation. This makes the Case Formatter work, since it appends to this file.
}
Mansol()
{
MsgBox, 262176, Manual & Solution Opener, Pressing Alt+Shift+S will open the Solution / Manual opener. Input numbers/letters and press enter.`nIf you input just numbers, it will try to open it as a DTAC solution.`nIf you enter letters and numbers, it will try to open it as a manual (best source for SKUs for manuals is Techpubs).
}
MJDPaste()
{
MsgBox, 262176, MyJohnDeere Paste, Made to use in the customer profile in Stellar Support where you can't paste in the email field for some reason.`n`nPress the Windows key and V to write out your Clipboard (what you copied with Ctrl+C)
}
CaseFormatter()
{
MsgBox, 262176, Case Formatter, Made to replace the Case Template for me.`n`nPause`tOpens up a window to choose what language, what source, and what (common) issue is going on. Press Alt and the underlined letter if you don't want to click the buttons. If its not a warrant or a demo, don't press those buttons. This is appended to a file, to be changed. Maybe a choose documentation file?`n`n\case`tTypes a timestamp, and some fields for the person's Name and Username.`n|case`tdoes the same thing as \case but in German
}
Symb()
{
eq := Chr(0x2248)
deg := Chr(0x00B0)
MsgBox, 262176, Symbols, Common symbols that aren't on the US keyboard`n`n`(eq)`t=`t%eq%`n(deg)`t=`t%deg%
}
Jdpn()
{
MsgBox, 262176, John Deere Product Names, Names of JD Products so that you don't have to type that all the time`nStart with ] for English, [ for German.`nat`tAutoTrac`nsf`tStarFire`njdlw`tJDLink Web`njdld`tJDLink Dashboard`njdlc`tJDLink Connect`njdla`tJDLink Access`njdls`tJDLink`njdll`tJDLink`njdp`tJDParts`nmjd`tMyJohnDeere`nopsc`tOperations Center`nseccon`tSection Control`ngs`tGreenStar`ncc`tCommandCenter`nfc`tField Connect`nrs`tRowSense`nsub`tSubscription`nss`tStellar Support`ntman`tTechnical Manual`nhl3`tHarvestLab 3000`nbin`tVirtual Inventory`nwarrep`tWarranty Reports`n`nThe following will complete as you type them:`nRowSense`nCOMAR`nmRTK`nRDA`nRTK`nAutoTrac`nCCMS`nDTAC`nTCSM`niTEC Pro`nSSU`nATU`nMTG`nWDT`niTC`nVIN`nGS2`nGS3`nSF1`nSF2`nSF3`nxID`nPMCalc
}
Glovar()
{
MsgBox, 262176, Global Variables, The ini file works like this: Hotstring on the left, result on the right. If you have it like xid=x501183, whenever you type $xid it will complete to x501183 and so on with the rest of them working the same way.`nYou can add more by going to a new line, entering an =, then putting the hotstring on the left.`n`nReplace the name of a section (the things in [square brackets]) with "clear" and it will empty out the whole thing and back up the ini and the documentation file to D3KLog.txt
}
Ger()
{
MsgBox, 262176, , Enables the same commands, but also in German (start them with [ instead)
}
General()
{
MsgBox, ]{shortcut} is the syntax here, [{shortcut} for German if enabled.`n`nEmail specific:`nemail`tEmail templateish thing`n97010`tEmail about DTAC problem`n2yc`t2 Year old COMAR
}