add functionality to GloVar for giving other people guest admin access

This commit is contained in:
David Daily 2020-05-22 13:01:26 -05:00
parent ab8f81db2c
commit b73be18a62

42
D3K.ahk
View File

@ -112,6 +112,15 @@ If (glovar = 1)
} }
} }
} }
If InStr(StoredSection, "GuestAdmin") ; If the section is "GuestAdmin", 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". If InStr(REKey, "case") ; If a key contains "case". Case numbers are all in the format "LETTERS-NUMBERS".
{ {
StringUpper, REValue, REValue ; Makes it uppercase StringUpper, REValue, REValue ; Makes it uppercase
@ -138,14 +147,46 @@ If (glovar = 1)
If (RESection) ; If we have a section If (RESection) ; If we have a section
{ {
StoredSection := RESection StoredSection := RESection
If InStr(RESection, "GuestAdmin") ; For giving other people access to orgs
{
If !(GuestAdmin)
{
FileRead, initemp, %glovarini% ; Read the ini
initemp := "[GuestAdmin]`nid=`nusr=`norg=`n[Info]`ncase="
FileAppend, %initemp%, temptemp
FileCopy, temptemp, %glovarini%, 1
FileDelete, temptemp
FileRead, gvMod, %glovarini%
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
}
}
GuestAdmin := True
}
If InStr(RESection, "clear") ; Will clear the ini and save its and the documentation file's contents to a log If InStr(RESection, "clear") ; Will clear the ini and save its and the documentation file's contents to a log
{
If !(GuestAdmin)
{ {
FileRead, doctemp, %docfile% ; Read documentation file, set in settings FileRead, doctemp, %docfile% ; Read documentation file, set in settings
}
FileRead, initemp, %glovarini% ; Read the ini FileRead, initemp, %glovarini% ; Read the ini
initemp := RegExReplace(initemp, "(?<=\[)clear(?=\])", "Info") ; Replace the "clear" section we set with Info 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" CurrTime := GetDateTime("en") ; get the current date and time as "YYYY-MM-DD at HH:MM GMT"
If !(GuestAdmin)
{
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 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
} else {
writethis := "Case on " . CurrTime . "`n`n" . initemp ; Save the current time and glovarini to a variable if it was just giving access to an org
}
FileAppend, % "`n`n" writethis "`n`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", %A_MyDocuments%/D3KLog.txt ; Write a few new lines , the content, and a line underneath FileAppend, % "`n`n" writethis "`n`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", %A_MyDocuments%/D3KLog.txt ; Write a few new lines , the content, and a line underneath
FileAppend,, temptemp FileAppend,, temptemp
FileCopy, glovarsource, %glovarini%, 1 ; Copies and replaces any text in glovar.ini with the template FileCopy, glovarsource, %glovarini%, 1 ; Copies and replaces any text in glovar.ini with the template
@ -161,6 +202,7 @@ If (glovar = 1)
{ {
Run glovar.ahk Run glovar.ahk
} }
GuestAdmin := False
Return Return
} }
} }