501 lines
15 KiB
AutoHotkey
501 lines
15 KiB
AutoHotkey
#Include, func.ahk
|
|
|
|
Menu, Tray, Icon, shell32.dll, 283 ; Set the tray icon to a keyboard
|
|
Menu, Tray, Add, Mouse Mover, Mouse_Mover ; Add item to the tray to move the mouse
|
|
Menu, Tray, Add, %A_AhkVersion%, docs
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Make sure the settings file exists, if not, create it
|
|
;------------------------------------------------------------------------------
|
|
|
|
If !FileExist(ini) ; Check if the ini doesn't exist
|
|
{
|
|
FileAppend,
|
|
(
|
|
; 0 is off, 1 is on
|
|
[USpec]
|
|
RACF=LF01234
|
|
Email=LastnameFirstname@JohnDeere.com
|
|
Name=Firstname
|
|
DocFile=Select File
|
|
[Main]
|
|
Mansol=1
|
|
MJDPaste=1
|
|
CaseFormatter=1
|
|
CFmail=0
|
|
[Replacement]
|
|
JDProductNames=1
|
|
GloVar=0
|
|
[Language]
|
|
German=0
|
|
), %ini%
|
|
Run Settings.ahk ; Runs the GUI for changing the settings, also accessible with Alt+Shift+\ (also easy way to restart this script)
|
|
}
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Read the 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:
|
|
racf := ini_get(ini, "USpec", "RACF")
|
|
email := ini_get(ini, "USpec", "Email")
|
|
name := ini_get(ini, "USpec", "Name")
|
|
docfile := ini_get(ini, "USpec", "DocFile")
|
|
|
|
; General Settings
|
|
mansol := ini_get(ini, "Main", "Mansol")
|
|
supadmin := ini_get(ini, "Main", "Supadmin")
|
|
mjdpaste := ini_get(ini, "Main", "MJDPaste")
|
|
caseformatter := ini_get(ini, "Main", "CaseFormatter")
|
|
|
|
; Replacement
|
|
jdpn := ini_get(ini, "Replacement", "JDProductNames")
|
|
glovar := ini_get(ini, "Replacement", "GloVar")
|
|
|
|
; Language
|
|
ger := ini_get(ini, "Language", "German")
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Global Variables
|
|
;------------------------------------------------------------------------------
|
|
|
|
If (glovar = 1)
|
|
{
|
|
glovarini := A_MyDocuments "\GloVar.ini" ; Location of the ini that the user modifies
|
|
|
|
glovarstart := "#SingleInstance force`n`n"
|
|
|
|
SetTimer, GloVar, 2000 ; Check every 2 seconds
|
|
|
|
GloVar:
|
|
WinWaitNotActive, GloVar.ini ; So that we don't get any problems with the file on disk being out of date. I use VSCode with the "Save on lose focus" option on, YMMV
|
|
{
|
|
FileGetTime, gvModNew, %glovarini%
|
|
if !(gvModNew = gvMod) ; Those two lines mean the rest of this only executes if there were changes to the ini.
|
|
{
|
|
gvMod := gvModNew
|
|
FileDelete, glovar.ahk ; Start with a clean slate
|
|
FileAppend, %glovarstart%, glovar.ahk ; makes sure we only have one instance of the script running at a time
|
|
|
|
RESection := "" ; Make sure that its clear
|
|
file := FileOpen(glovarini, "r")
|
|
Loop ; Read one line at a time
|
|
{
|
|
Line := file.ReadLine()
|
|
RegExMatch(Line, "(?<=\[).*(?=\])", RESection) ; explained above
|
|
RegExMatch(Line, "^(?<Key>.*)=(?<Value>.*)", RE) ; Key = REKey, Value = REValue
|
|
|
|
If !(RESection) ; If the RegEx doesn't find antything, its empty
|
|
{
|
|
If !(REValue) ; If there is no value for the key, skip it (Continue the loop at the next line)
|
|
{
|
|
Continue
|
|
}
|
|
If InStr(StoredSection, "Serial Numbers") ; If the section is "Serial Numbers", make everything uppercase
|
|
{
|
|
StringUpper, REValue, REValue ; Makes it uppercase
|
|
WinWaitNotActive, GloVar.ini ; Just to make sure
|
|
{
|
|
ini_write(glovarini, REKey, REValue)
|
|
FileGetTime, gvMod, %glovarini%
|
|
}
|
|
}
|
|
If InStr(REKey, "case") ; If a key contains "case". Case numbers are all in the format "LETTERS-NUMBERS".
|
|
{
|
|
StringUpper, REValue, REValue ; Makes it uppercase
|
|
RegExMatch(REValue, "(?<=\().*(?=\))", REMatch) ; Match everything but the parenthesis. When the case numbers are shown they have parenthesis, and those are annoying.
|
|
If (REMatch) ; If there's anything there
|
|
{
|
|
WinWaitNotActive, GloVar.ini
|
|
{
|
|
ini_write(glovarini, REKey, REMatch) ; Writes the properly formatted case number to glovar.ini
|
|
FileGetTime, gvMod, %glovarini%
|
|
}
|
|
REValue := REMatch
|
|
} Else {
|
|
WinWaitNotActive, GloVar.ini
|
|
{
|
|
ini_write(glovarini, REKey, REValue) ; Writes the properly formatted case number to glovar.ini
|
|
FileGetTime, gvMod, %glovarini%
|
|
}
|
|
}
|
|
}
|
|
writethis := ":*:$" REKey "::" REValue "`n" ; Save the hotstring to a variable
|
|
FileAppend, %writethis%, glovar.ahk ; Write the variable to glovar.ahk
|
|
}
|
|
If (RESection) ; If we have a section
|
|
{
|
|
StoredSection := RESection
|
|
If InStr(RESection, "clear") ; Will clear the ini and save its and the documentation file's contents to a log
|
|
{
|
|
FileRead, doctemp, %docfile% ; Read documentation file, set in settings
|
|
FileRead, initemp, %glovarini% ; Read the ini
|
|
initemp := RegExReplace(initemp, "(?<=\[)clear(?=\])", "Info") ; Replace the "clear" section we set with Info
|
|
CurrTime := GetDateTime("en") ; get the current date and time as "YYYY-MM-DD at HH:MM GMT"
|
|
writethis := "Case on " . CurrTime . "`n`n`n" . doctemp . "`n`n" . initemp ; Save the current time, what was in the doc file, and glovarini to a variable
|
|
FileAppend, % "`n`n" writethis "`n`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", %A_MyDocuments%/D3KLog.txt ; Write a few new lines , the content, and a line underneath
|
|
FileAppend,, temptemp
|
|
FileCopy, glovarsource, %glovarini%, 1 ; Copies and replaces any text in glovar.ini with the template
|
|
FileCopy, temptemp, %docfile%, 1 ; These two this close together makes it look like they get cleared at the same time
|
|
FileDelete, temptemp
|
|
fileread, gvMod, %glovarini% ; Make sure that this script knows what the ini was changed to so it doesn't constantly run through the above code
|
|
FileDelete, glovar.ahk ; THE CLEAN SLATE
|
|
FileAppend, %glovarstart%, glovar.ahk
|
|
Sleep, 500
|
|
FileGetTime, gvMod, %glovarini% ; Make sure that this script knows what the ini was changed to so it doesn't constantly run through the above code
|
|
If FileExist("glovar.ahk")
|
|
{
|
|
Run glovar.ahk
|
|
}
|
|
Return
|
|
}
|
|
}
|
|
} Until (file.AtEOF)
|
|
file.Close()
|
|
FileGetTime, gvMod, %glovarini% ; Make sure that this script knows what the ini was changed to so it doesn't constantly run through the above code
|
|
If FileExist("glovar.ahk")
|
|
{
|
|
Run glovar.ahk
|
|
ToolTip, glovar updated, 50, 50
|
|
Sleep, 500
|
|
ToolTip
|
|
}
|
|
}
|
|
}
|
|
Return
|
|
}
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Settings window
|
|
;------------------------------------------------------------------------------
|
|
|
|
!+\::Run Settings.ahk ; Alt+Shift+\
|
|
|
|
Mouse_Mover:
|
|
Run, msmv.ahk
|
|
Return
|
|
|
|
;------------------------------------------------------------------------------
|
|
; DTAC Solution Opener
|
|
;------------------------------------------------------------------------------
|
|
|
|
#If, mansol = "1" ; checks from the variable thats set from the .ini file
|
|
!+S::Run Mansol_Opener.ahk ; Alt+Shift+S
|
|
#If ; these are to make sure one "if" doesn't influence the next accidentially
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Case Formatter
|
|
;------------------------------------------------------------------------------
|
|
|
|
#If, CaseFormatter = "1"
|
|
Pause::Run Case_Formatter.ahk ; The Pause|Break key
|
|
#If
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; Special Characters
|
|
;-------------------------------------------------------------------------------
|
|
|
|
#If, ger = "1"
|
|
; scharfes s / Eszett / ß
|
|
!s::Send {U+00DF} ;Alt+S
|
|
|
|
; ä
|
|
!a::Send {U+00E4} ;Alt+a
|
|
|
|
; ö
|
|
!o::Send {U+00F6} ;Alt+o
|
|
|
|
; ü
|
|
!u::Send {U+00FC} ;Alt+u
|
|
|
|
; Ä
|
|
+!A::Send {U+00C4} ;Alt+A
|
|
|
|
; Ö
|
|
+!O::Send {U+00D6} ;Alt+O
|
|
|
|
; Ü
|
|
+!U::Send {U+00DC} ;Alt+U
|
|
|
|
#If
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; Capitalise dates
|
|
;-------------------------------------------------------------------------------
|
|
|
|
::monday::Monday
|
|
::tuesday::Tuesday
|
|
::wednesday::Wednesday
|
|
::thursday::Thursday
|
|
::friday::Friday
|
|
::saturday::Saturday
|
|
::sunday::Sunday
|
|
|
|
::january::January
|
|
::february::February
|
|
; ::march::March ; Commented out because it matches the common word "march".
|
|
::april::April
|
|
; ::may::May ; Commented out because it matches the common word "may".
|
|
::june::June
|
|
::july::July
|
|
::august::August
|
|
::september::September
|
|
::october::October
|
|
::november::November
|
|
::december::December
|
|
|
|
|
|
; German
|
|
#If, ger = "1"
|
|
::montag::Montag
|
|
::dienstag::Dienstag
|
|
::mittwoch::Mittwoch
|
|
::donnerstag::Donnerstag
|
|
::freitag:: Freitag
|
|
::samstag::Samstag
|
|
::sonntag::Sonntag
|
|
|
|
::januar::Januar
|
|
::februar::Februar
|
|
::märz::März
|
|
::mai::Mai
|
|
::juni::Juni
|
|
::juli::Juli
|
|
::oktober::Oktober
|
|
::dezebmer::Dezember
|
|
#If
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Copypastas
|
|
;------------------------------------------------------------------------------
|
|
;STWA Applied
|
|
:*:]cms::
|
|
Send STWA applied{Enter 2}Status: Providing information{Enter 2}Comments:{Space}{Enter 2}Thank you,{Enter}%name%{Enter 2}Tier 2 internal steps:{Space}{Enter 2}SQL:{Enter}
|
|
Return
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Email
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Regular
|
|
:*:]email::
|
|
Send Hello,{Enter 2}{Space 3}
|
|
Return
|
|
|
|
|
|
; German
|
|
#If, ger = "1"
|
|
|
|
; Regular
|
|
:*:[email::
|
|
Send Hallo,{Enter 2}{Space 3}
|
|
Return
|
|
#If
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Profile email paste
|
|
;------------------------------------------------------------------------------
|
|
; So when editing Profiles, it won't let you paste in the email field. We don't like that. Make sure to let go of all keys immediatley after pressing this
|
|
|
|
#If, mjdpaste = "1"
|
|
#v::
|
|
sleep, 750
|
|
Send %clipboard%
|
|
sleep, 500
|
|
send # ; to make sure the start menu isn't open for some reason
|
|
return
|
|
#If
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
; Common Terms autocorrect and replacement
|
|
;------------------------------------------------------------------------------
|
|
|
|
#If, not(racf = "LF01234") ; So that it doesn't put the fake RACF from the default ini file
|
|
:*:]me::
|
|
Send, %racf%
|
|
return
|
|
|
|
:*:[me::
|
|
Send, %racf%
|
|
return
|
|
#If
|
|
|
|
#If, not(email = "LastnameFirstname@JohnDeere.com") ; Same as above
|
|
:*:@me::
|
|
Send, %email%
|
|
Return
|
|
#If
|
|
|
|
; JD Names
|
|
#If, jdpn = "1"
|
|
|
|
:*:[xx::XXXXXXXXXXXXX ; I'm not gonna try and find the right amount of X's to appease the CCMS demons
|
|
:*:]xx::XXXXXXXXXXXXX
|
|
|
|
; English
|
|
:*:]at::AutoTrac
|
|
:*:]sf::StarFire
|
|
:*:]jdld::JDLink Dashboard
|
|
:*:]jdlc::JDLink Connectivity
|
|
:*:]jdls::JDLink Subscription
|
|
:*:]jdll::JDLink
|
|
:*:]jdp::JDParts
|
|
:*:]mjd::MyJohnDeere
|
|
:*:]opsc::Operations Center
|
|
:*:]seccon::Section Control
|
|
:*:]gs::GreenStar
|
|
:*:]cc::CommandCenter
|
|
:*:]fc::Field Connect
|
|
:*:]rs::RowSense
|
|
:*:]sub::subscription
|
|
:*:]ss::Stellar Support
|
|
:*:]tman::Technical Manual
|
|
:*:]oman::Operator's Manual
|
|
:*:]hl3::HarvestLab 3000
|
|
:*:]hlo::Original HarvestLab
|
|
:*:]bin::Virtual Inventory
|
|
:*:]warrep::Warranty Reports
|
|
:*:]tcsm::Territory Customer Support Manager
|
|
:*:]macrep::Machine Reports
|
|
:*:]jdsm::John Deere Software Manager
|
|
:*:]jddm::John Deere Data Manager
|
|
:*:]serva::Service Advisor
|
|
:*:]muc::Master Unlock Code
|
|
:*:]asmn::Asset Manager
|
|
:*:]bsm::Base Station Manager
|
|
|
|
|
|
::rowsense::RowSense
|
|
:*:comar::COMAR
|
|
::mrtk::mRTK
|
|
::rda::RDA
|
|
::rtk::RTK
|
|
::autotrac::AutoTrac
|
|
:*:ccms::CCMS
|
|
:*:dtac::DTAC
|
|
::tcsm::TCSM
|
|
::itec::iTEC Pro
|
|
::ssu::SSU
|
|
::atu::ATU
|
|
:*:mtg::MTG
|
|
::wdt::WDT
|
|
::itc::iTC
|
|
:*:vin::Machine PIN ; Not actually vehicles, so they don't have VINs
|
|
::gs2::GS2
|
|
::gs3::GS3
|
|
::sf1::SF1
|
|
::sf2::SF2
|
|
::sf3::SF3
|
|
::sf4::SF4
|
|
::xid::xID
|
|
::pmcalc::PMCalc
|
|
::vat::VAT
|
|
:*:racf::RACF
|
|
::igrade::iGrade
|
|
:*:JDCP::JDCP
|
|
:*:ISOBUS::ISOBUS
|
|
|
|
|
|
; German
|
|
#If, ger = "1"
|
|
:*:[at::AutoTrac
|
|
:*:[sf::StarFire
|
|
:*:[jdlw::JDLink Web
|
|
:*:[jdld::JDLink Dashboard
|
|
:*:[jdl2::JDLink Dashboard 2.0
|
|
:*:[jdlc::JDLink Connectivity
|
|
:*:[jdls::JDLink Abonnement
|
|
:*:[jdll::JDLink
|
|
:*:[jdp::JDParts
|
|
:*:[mjd::MyJohnDeere
|
|
:*:[opsc::Einsatzzentrale
|
|
:*:[seccon::Teilbreitensteuerung
|
|
:*:[gs::GreenStar
|
|
:*:[cc::CommandCenter
|
|
:*:[fc::Field Connect
|
|
:*:[rs::RowSense
|
|
:*:[sub::Abonnement
|
|
:*:[ss::Stellar Support
|
|
:*:[tman::Technische Betriebsanleitung
|
|
:*:[oman::Betriebsanleitung
|
|
:*:[hl3::HarvestLab 3000
|
|
:*:[hlo::Originales HarvestLab
|
|
:*:[bin::Virtuellen Bestand
|
|
:*:[warrep::Warranty Reports
|
|
:*:[tp::TouchPoint
|
|
:*:[tcsm::Technischer Bezirksleiter
|
|
:*:[macrep::Machine Reports
|
|
:*:[jdsm::John Deere Software Manager
|
|
:*:[jddm::John Deere Data Manager
|
|
:*:[serva::Service Advisor
|
|
:*:[muc::Master Unlock Code
|
|
:*:[asmn::Asset Manager
|
|
:*:[bsm::Base Station Manager
|
|
#If
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
; QoL Improvements
|
|
;------------------------------------------------------------------------------
|
|
|
|
#j:: ; Open the downloads folder on Win+J
|
|
Run, C:\Users\%racf%\Downloads
|
|
Return
|
|
|
|
#w:: ; Open My Documents folder on Win+W
|
|
Run, C:\Users\%racf%\Documents
|
|
Return
|
|
|
|
:*:[now:: ; Send the current time/date in ISO8601 format
|
|
:*:]now::
|
|
d_t := GetDateTime("ISO8601")
|
|
SendInput, %d_t%
|
|
Return
|
|
|
|
:*:[today:: ; Send the current date in ISO8601 format
|
|
:*:]today::
|
|
d_t := GetDateTime("date")
|
|
SendInput, %d_t%
|
|
Return
|
|
|
|
:*:[deg::{ASC 248}
|
|
:*:]deg::{ASC 248}
|
|
:*:[eq::{ASC 247}
|
|
:*:]eq::{ASC 247}
|
|
|
|
:*:[shrug::¯\_(ツ)_/¯
|
|
:*:]shrug::¯\_(ツ)_/¯
|
|
|
|
asciiart(art)
|
|
{
|
|
For index, value in art
|
|
{
|
|
SendInput, %value%{ShiftDown}{Enter}{ShiftUp}
|
|
}
|
|
Return
|
|
}
|
|
|
|
:*:]yee::
|
|
art := ["░░░░░░░░░░░░░▄███▄▄▄░░░░░░░","░░░░░░░░░▄▄▄██▀▀▀▀███▄░░░░░","░░░░░░░▄▀▀░░░░░░░░░░░▀█░░░░","░░░░▄▄▀░░░░░░░░░░░░░░░▀█░░░","░░░█░░░░░▀▄░░▄▀░░░░░░░░█░░░","░░░▐██▄░░▀▄▀▀▄▀░░▄██▀░▐▌░░░","░░░█▀█░▀░░░▀▀░░░▀░█▀░░▐▌░░░","░░░█░░▀▐░░░░░░░░▌▀░░░░░█░░░","░░░█░░░░░░░░░░░░░░░░░░░█░░░","░░░░█░░▀▄░░░░▄▀░░░░░░░░█░░░","░░░░█░░░░░░░░░░░▄▄░░░░█░░░░","░░░░░█▀██▀▀▀▀██▀░░░░░░█░░░░","░░░░░█░░▀████▀░░░░░░░█░░░░░","░░░░░░█░░░░░░░░░░░░▄█░░░░░░","░░░░░░░██░░░░░█▄▄▀▀░█░░░░░░","░░░░░░░░▀▀█▀▀▀▀░░░░░░█░░░░░", "yee ░░░░░█░░░░░░░░░░░░█░░░░"]
|
|
asciiart(art)
|
|
Return
|
|
|
|
:*:]glass::
|
|
art := ["▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄", "█░░░░░░░░▀█▄▀▄▀██████░▀█▄▀▄▀██████░", "░░░░░░░░░░░▀█▄█▄███▀░░░▀██▄█▄███▀░"]
|
|
asciiart(art)
|
|
Return
|
|
|
|
docs:
|
|
run https://www.autohotkey.com/docs/AutoHotkey.htm
|
|
Return |