d3k/Case_Formatter.ahk
2020-01-08 10:48:21 -06:00

170 lines
4.2 KiB
AutoHotkey

#Include, func.ahk
SetTitleMatchMode, 2
ini = %A_MyDocuments%\D3Ksettings.ini
; These next 3 options make it so that it's always on top, it there are no buttons, and doesn't show up in the alt-tab or taskbar
Gui,+AlwaysOnTop
Gui, +ToolWindow
IniRead, docfile, %ini%, USpec, DocFile, 0
CurrTimeEN := GetDateTime("en")
CurrTimeDE := GetDateTime("de")
;------------------------------------------------------------------------------
; GUI creation
;------------------------------------------------------------------------------
; The & in front of the letters lets you hold alt and press the first letter instead of having to click on it. That is why its "Mail", not "E-Mail"
Gui, Add, Text, x75 y46 w150 h20 gTime, %CurrTimeEN%
Gui, Add, Radio, x12 y3 w60 h20 Group vLang Checked, &English ; First group of Radio buttons
Gui, Add, Radio, x12 y23 w60 h20, &German
Gui, Add, Radio, x82 y3 w60 h20 Group vContact Checked, E-&Mail ; Second group of Radio buttons
Gui, Add, Radio, x82 y23 w60 h20, &Call
Gui, Add, Radio, x142 y3 w80 h20 Group vAct, &Warrant
Gui, Add, Radio, x142 y23 w80 h20 , &Demo
Gui, Add, Button, x12 y43 w55 h20 Default vHidden, Go ; That way you don't have to have an actual button, it just happens when you press enter.
Gui, Show, h70 w210, Contact
;GuiControl, Hide, Hidden ; Hide the button to be hidden
Return
Time:
Run, addemail.ahk
GuiClose:
GuiEscape:
ExitApp
;------------------------------------------------------------------------------
; Buttons
;------------------------------------------------------------------------------
ButtonGo:
Gui, submit
Goto, Write
Return
/*
Contact
Mail: 1
Call: 2
Lang
English: 1
German: 2
Act
Warrant: 1
Demo: 2
*/
Write:
{
FileRead, NewLine, %docfile% ; Read the documentation file
If (NewLine != "") ; If there is something in the file, this would return a string
{
FileAppend,`n`n`n`n, %docfile% ; Inserts a new line so that it isn't just appended directly to the end
}
NewLine := "" ; Free up Memory cause this could be quite a bit of stuff
;------------------------------------------------------------------------------
; Email
;------------------------------------------------------------------------------
If (Contact = "1")
{
If (Lang = "1") ; English
{
If (Act = "0") ; Not an activation
{
FileAppend,Dealer emailed: "", %docfile%
}
If (Act = "1") ; Warrant
{
FileAppend,Dealer emailed for warrant transfer: ""`n`nOld SN: `nNew SN: `nChallenge Code: `n`n, %docfile%
}
If (Act = "2") ; Demo
{
FileAppend,Dealer emailed for `n`nSN: `nChallenge Code: `n`n, %docfile%
}
}
Else If (Lang = "2") ; German
{
If (Act = "0") ; Not an activation
{
FileAppend,Händler emailte: "", %docfile%
}
Else If (Act = "1") ; Warrant
{
FileAppend,Händler emailte für Garantieübertragung`n`nAlte SN: `nNeue SN: `nAuthentisierungscode: `n`n, %docfile%
}
Else If (Act = "2") ; Demo
{
FileAppend,Händler emailte für `n`nSN: `nAuthentisierungscode: `n`n, %docfile%
}
}
}
;------------------------------------------------------------------------------
; Call
;------------------------------------------------------------------------------
Else If (Contact = "2")
{
If (Lang = "1") ; English
{
FileAppend, Call received %CurrTimeEN%.`n`n, %docfile%
If (Act = "0") ; Not an activation
{
FileAppend,Dealer called for, %docfile%
}
Else If (Act = "1") ; Warrant
{
FileAppend,Dealer called for Warrant transfer`nOld SN: `nNew SN: `nChallenge Code: `n`n, %docfile%
}
Else If (Act = "2") ; Demo
{
FileAppend,Dealer called for Demo`nSN: `nChallenge Code: `n`n, %docfile%
}
}
Else If (Lang = "2") ; German
{
FileAppend, Anruf wurde %CurrTimeDE% entgegengenommen.`n`n, %docfile%
If (Act = "0") ; Not an activation
{
FileAppend,Händler rief an mit, %docfile%
}
Else If (Act = "1") ; Warrant
{
FileAppend,Händler rief an für Garantieübertragung`nAlte SN: `nNeue SN: `nAuthentisierungscode: `n`n, %docfile%
}
Else If (Act = "2") ; Demo
{
FileAppend,Händler rief an für Demo`nSN: `nAuthentisierungscode: `n`n, %docfile%
}
}
}
ExitApp
}