Add support for updating the dealer information
wrote a new function for this, check func.ahk: f6d0981b3b
This commit is contained in:
parent
98ec36cd5c
commit
67dd119939
94
D3K.ahk
94
D3K.ahk
@ -83,6 +83,61 @@ If (glovar = 1)
|
|||||||
RegExMatch(A_LoopReadLine, "(?<=\[).*(?=\])", RESection) ; explained above
|
RegExMatch(A_LoopReadLine, "(?<=\[).*(?=\])", RESection) ; explained above
|
||||||
RegExMatch(A_LoopReadLine, "^(?<Key>.*)=(?<Value>.*)", RE) ; Key = REKey, Value = REValue
|
RegExMatch(A_LoopReadLine, "^(?<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
|
||||||
|
}
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
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
|
||||||
{
|
{
|
||||||
If !(REValue) ; If there is no value for the key, skip it (Continue the loop at the next line)
|
If !(REValue) ; If there is no value for the key, skip it (Continue the loop at the next line)
|
||||||
@ -156,6 +211,7 @@ If (glovar = 1)
|
|||||||
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
|
||||||
@ -168,44 +224,6 @@ 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
|
|
||||||
}
|
|
||||||
If InStr(RESection, "up")
|
|
||||||
{
|
|
||||||
new_email := ini_getValue(%glovarini%, "up", "dem")
|
|
||||||
new_name := ini_getValue(%glovarini%, "up", "dnm")
|
|
||||||
new_user := ini_getValue(%glovarini%, "up", "dus")
|
|
||||||
new_org := ini_getValue(%glovarini%, "up", "dorg")
|
|
||||||
xID := ini_getValue(%glovarini%, "up", "xID")
|
|
||||||
|
|
||||||
StringUpper, new_user, new_user
|
|
||||||
SetInfo(xID, "email", new_email)
|
|
||||||
SetInfo(xID, "name", new_name)
|
|
||||||
SetInfo(xID, "user", new_user)
|
|
||||||
SetInfo(xID, "org", new_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
|
||||||
If FileExist("glovar.ahk")
|
If FileExist("glovar.ahk")
|
||||||
|
Loading…
Reference in New Issue
Block a user