rolling back changes, making it use a file object instead of the default way
This commit is contained in:
parent
6acd69fd87
commit
03cfca5549
113
D3K.ahk
113
D3K.ahk
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
Menu, Tray, Icon, shell32.dll, 283 ; Set the tray icon to a keyboard
|
Menu, Tray, Icon, shell32.dll, 283 ; Set the tray icon to a keyboard
|
||||||
|
|
||||||
ini_writeValue(ini, "Version", d3k_version)
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; Make sure the settings file exists, if not, create it
|
; Make sure the settings file exists, if not, create it
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@ -63,7 +61,7 @@ If (glovar = 1)
|
|||||||
{
|
{
|
||||||
glovarini = %A_MyDocuments%\GloVar.ini ; Location of the ini that the user modifies
|
glovarini = %A_MyDocuments%\GloVar.ini ; Location of the ini that the user modifies
|
||||||
|
|
||||||
glovarstart := "#SingleInstance force`n`n:*:$dus::`n:*:$dorg::`n:*:$dnm::`n:*:$dem::`n:*:$xid::`n"
|
glovarstart := "#SingleInstance force`n`n:*:$dus::`n:*:$dnm::`n:*:$dem::`n:*:$xid::`n"
|
||||||
|
|
||||||
SetTimer, GloVar, 2000 ; Check every 2 seconds
|
SetTimer, GloVar, 2000 ; Check every 2 seconds
|
||||||
|
|
||||||
@ -78,64 +76,12 @@ If (glovar = 1)
|
|||||||
FileAppend, %glovarstart%, glovar.ahk ; makes sure we only have one instance of the script running at a time
|
FileAppend, %glovarstart%, glovar.ahk ; makes sure we only have one instance of the script running at a time
|
||||||
|
|
||||||
RESection := "" ; Make sure that its clear
|
RESection := "" ; Make sure that its clear
|
||||||
Loop, Read, %glovarini% ; Read one line at a time
|
file := FileOpen(glovarini, "r")
|
||||||
|
Loop ; Read one line at a time
|
||||||
{
|
{
|
||||||
RegExMatch(A_LoopReadLine, "(?<=\[).*(?=\])", RESection) ; explained above
|
Line := file.ReadLine()
|
||||||
RegExMatch(A_LoopReadLine, "^(?<Key>.*)=(?<Value>.*)", RE) ; Key = REKey, Value = REValue
|
RegExMatch(Line, "(?<=\[).*(?=\])", RESection) ; explained above
|
||||||
|
RegExMatch(Line, "^(?<Key>.*)=(?<Value>.*)", RE) ; Key = REKey, Value = REValue
|
||||||
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" . doctemp . "`n`n" . initemp ; Save the current time, what was in the doc file, and glovarini to a variable
|
|
||||||
FileAppend, % "`n`n`n`n" writethis "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", %A_MyDocuments%/D3KLog.txt ; Write a few new lines , the content, and a line underneath
|
|
||||||
FileCopy, glovarsource, %glovarini%, 1 ; Copies and replaces any text in glovar.ini with the template
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
If InStr(RESection, "up")
|
|
||||||
{
|
|
||||||
xID := ini_getValue(glovarini, "up", "xID")
|
|
||||||
|
|
||||||
new_email := ini_getValue(glovarini, "up", "dem")
|
|
||||||
if (new_email)
|
|
||||||
{
|
|
||||||
SetInfo(xID, "email", new_email)
|
|
||||||
}
|
|
||||||
|
|
||||||
new_name := ini_getValue(glovarini, "up", "dnm")
|
|
||||||
if (new_name)
|
|
||||||
{
|
|
||||||
SetInfo(xID, "name", new_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
new_user := ini_getValue(glovarini, "up", "dus")
|
|
||||||
if (new_user)
|
|
||||||
{
|
|
||||||
StringUpper, new_user, new_user
|
|
||||||
SetInfo(xID, "user", new_user)
|
|
||||||
}
|
|
||||||
|
|
||||||
new_org := ini_getValue(glovarini, "up", "dorg")
|
|
||||||
if (new_org)
|
|
||||||
{
|
|
||||||
new_org .= "`r`n"
|
|
||||||
SetInfo(xID, "org", new_org)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
If !(RESection) ; If the RegEx doesn't find antything, its empty
|
If !(RESection) ; If the RegEx doesn't find antything, its empty
|
||||||
{
|
{
|
||||||
@ -184,16 +130,14 @@ If (glovar = 1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
If InStr(REKey, "xID") ; If an xID is entered. Unique identifier for people
|
If InStr(REKey, "xid") ; If an xID is entered. Unique identifier for people
|
||||||
{
|
{
|
||||||
StringUpper, REValue, REValue ; Makes xID uppercase
|
|
||||||
dealinfo := GetInfo(REValue) ; Gets information, see function for details
|
dealinfo := GetInfo(REValue) ; Gets information, see function for details
|
||||||
|
StringUpper, REValue, REValue ; Makes xID uppercase
|
||||||
|
|
||||||
if !(InStr(dealinfo.xid, REValue))
|
if !(REValue = dealinfo.xid)
|
||||||
{
|
{
|
||||||
MsgBox, run
|
|
||||||
run addemail.ahk
|
run addemail.ahk
|
||||||
FileGetTime, gvMod, %glovarini%
|
|
||||||
Continue
|
Continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,16 +152,17 @@ If (glovar = 1)
|
|||||||
FileCopy, tempglovar, glovar.ahk,1
|
FileCopy, tempglovar, glovar.ahk,1
|
||||||
FileDelete, tempglovar
|
FileDelete, tempglovar
|
||||||
|
|
||||||
|
WinWaitNotActive, GloVar.ini
|
||||||
|
{
|
||||||
ini_writeValue(glovarini, "xID", REValue) ; Writes the xID entered, but uppercase
|
ini_writeValue(glovarini, "xID", REValue) ; Writes the xID entered, but uppercase
|
||||||
ini_writeValue(glovarini, "dem", dealinfo.email) ; Writes email address (incredibly useful)
|
ini_writeValue(glovarini, "dem", dealinfo.email) ; Writes email address (incredibly useful)
|
||||||
ini_writeValue(glovarini, "dnm", dealinfo.name) ; Writes Name (useful for when referring to that person)
|
ini_writeValue(glovarini, "dnm", dealinfo.name) ; Writes Name (useful for when referring to that person)
|
||||||
ini_writeValue(glovarini, "dus", dealinfo.user) ; Writes demo account name (somewhat useful)
|
ini_writeValue(glovarini, "dus", dealinfo.user) ; Writes demo account name (somewhat useful)
|
||||||
ini_writeValue(glovarini, "dorg", dealinfo.org)
|
}
|
||||||
|
|
||||||
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
|
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
|
||||||
Continue
|
Continue
|
||||||
}
|
}
|
||||||
If (InStr(REKey, "dem") or InStr(REKey, "dnm") or InStr(REKey, "dus") or InStr(REKey, "dorg"))
|
If (InStr(REKey, "dem") or InStr(REKey, "dnm") or InStr(REKey, "dus"))
|
||||||
{
|
{
|
||||||
; Do not process xID related info, that is done above
|
; Do not process xID related info, that is done above
|
||||||
Continue
|
Continue
|
||||||
@ -225,7 +170,32 @@ If (glovar = 1)
|
|||||||
writethis := ":*:$" REKey "::" REValue "`n" ; Save the hotstring to a variable
|
writethis := ":*:$" REKey "::" REValue "`n" ; Save the hotstring to a variable
|
||||||
FileAppend, %writethis%, glovar.ahk ; Write the variable to glovar.ahk
|
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" . doctemp . "`n`n" . initemp ; Save the current time, what was in the doc file, and glovarini to a variable
|
||||||
|
FileAppend, % "`n`n`n`n" writethis "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", %A_MyDocuments%/D3KLog.txt ; Write a few new lines , the content, and a line underneath
|
||||||
|
FileCopy, glovarsource, %glovarini%, 1 ; Copies and replaces any text in glovar.ini with the template
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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
|
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")
|
If FileExist("glovar.ahk")
|
||||||
{
|
{
|
||||||
@ -656,12 +626,9 @@ Return
|
|||||||
if WinActive("ahk_exe Explorer.EXE") ; If windows explorer is focused
|
if WinActive("ahk_exe Explorer.EXE") ; If windows explorer is focused
|
||||||
{
|
{
|
||||||
Send !d ; Focus the address bar
|
Send !d ; Focus the address bar
|
||||||
Send %A_MyDocuments%\Work_Docs\Cases\2020-01 - 06 ; current folder
|
Send C:\Users\%racf%\Documents\Work_Docs\Cases\2020-01 - 06 ; current folder, would love to use a var instead, but Run doesn't like it
|
||||||
Send {Enter}
|
Send {Enter}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
else
|
Run, C:\Users\%racf%\Documents\Work_Docs\Cases\2020-01 - 06 ; Open the documentation folder on Win+W
|
||||||
{
|
|
||||||
Run, %A_MyDocuments%\Work_Docs\Cases\2020-01 - 06 ; Open the documentation folder on Win+W
|
|
||||||
}
|
|
||||||
Return
|
Return
|
Loading…
Reference in New Issue
Block a user