d3k/Settings.ahk

263 lines
8.8 KiB
AutoHotkey
Raw Normal View History

2019-12-18 04:40:19 -06:00
#SingleInstance force ; Only one instance at a time
SendMode, Input
FileEncoding, UTF-8 ; Makes sure the special characters don't break stuff
#Include, func.ahk
Menu, Tray, Icon, shell32.dll, 283
;------------------------------------------------------------------------------
; Read 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
*/
; User Specific things:
IniRead, racf, %ini%, USpec, RACF
IniRead, email, %ini%, USpec, Email
IniRead, docfile, %ini%, USpec, DocFile
; General Settings
IniRead, mansol, %ini%, Main, Mansol
IniRead, mjdpaste, %ini%, Main, MJDPaste
IniRead, caseformatter, %ini%, Main, CaseFormatter
; Replacement
IniRead, symb, %ini%, Replacement, Symbols
IniRead, jdpn, %ini%, Replacement, JDProductNames
IniRead, glovar, %ini%, Replacement, GloVar
; Language
IniRead, ger, %ini%, Language, German
;------------------------------------------------------------------------------
; Create GUI
;------------------------------------------------------------------------------
Gui, -MaximizeBox -MinimizeBox +E0x00000400 ; Remove the max+min buttons, add the Help questionmark
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
Gui, Add, GroupBox, x128 y83 w157 h105, Text Replacement
Gui, Add, CheckBox, x132 y95 w150 h30 vformSymb Checked%symb% gSymb, Symbols
Gui, Add, CheckBox, x132 y125 w150 h30 vformJdpn Checked%jdpn% gJdpn, JD Product Names
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, Text, x237 y203 w100 h20, %d3k_version%
Gui, Show, h225 w295, David 3000 Settings
OnMessage(0x0053, "Help") ; Goes to the Help() function when you click after pressing the help button
Return
; All Help stuff is functions, INI writing is labels
;------------------------------------------------------------------------------
; Edit ini
;------------------------------------------------------------------------------
/*
Default ini, sections are in []:
[USpec]
RACF=LF01234
Email=LastnameFirstname@example.com
DocFile=
[Main]
Mansol=1
MJDPaste=1
CaseFormatter=1
[Replacement]
Symbols=1
JDProductNames=1
GloVar=0
[Language]
German=0
[Info]
Version=2.5
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:
Gui, Submit, NoHide
IniWrite, %formRACF%, %ini%, USpec, RACF
Return
Email:
Gui, Submit, NoHide
IniWrite, %formEmail%, %ini%, USpec, Email
Return
DocFile:
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
IniWrite, %SelectedFile%, %ini%, USpec, DocFile
IniRead, docfile, %ini%, USpec, DocFile
Gui, Show, h225 w295, David 3000 Settings
OnMessage(0x0053, "Help") ; Goes to the Help() function when you click after pressing the help button
Return
Mansol:
Gui, Submit, NoHide
IniWrite, %formMansol%, %ini%, Main, Mansol
Return
MJDPaste:
Gui, Submit, NoHide
IniWrite, %formMJDPaste%, %ini%, Main, MJDPaste
Return
CaseFormatter:
Gui, Submit, NoHide
IniWrite, %formCaseFormatter%, %ini%, Main, CaseFormatter
Return
Symb:
Gui, Submit, NoHide
IniWrite, %formSymb%, %ini%, Replacement, Symbols
Return
Jdpn:
Gui, Submit, NoHide
IniWrite, %formJdpn%, %ini%, Replacement, JDProductNames
Return
Glovar:
Gui, Submit, NoHide
IniWrite, %formGlovar%, %ini%, Replacement, GloVar
Return
Ger:
Gui, Submit, NoHide
IniWrite, %formGer%, %ini%, Language, German
Return
GuiClose:
GuiEscape:
Run D3K.ahk
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
2019-12-18 04:39:24 -06:00
}