abandoning csv modification project
This commit is contained in:
parent
2bf4b8e8a9
commit
c3c2da7120
51
D3K.ahk
51
D3K.ahk
@ -24,8 +24,6 @@ JDProductNames=1
|
|||||||
GloVar=0
|
GloVar=0
|
||||||
[Language]
|
[Language]
|
||||||
German=0
|
German=0
|
||||||
[Info]
|
|
||||||
Version=0
|
|
||||||
), %ini%
|
), %ini%
|
||||||
Run Settings.ahk ; Runs the GUI for changing the settings, also accessible with Alt+Shift+\ (also easy way to restart this script)
|
Run Settings.ahk ; Runs the GUI for changing the settings, also accessible with Alt+Shift+\ (also easy way to restart this script)
|
||||||
}
|
}
|
||||||
@ -36,22 +34,22 @@ Run Settings.ahk ; Runs the GUI for changing the settings, also accessible with
|
|||||||
; 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
|
; 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:
|
; User Specific things:
|
||||||
racf := ini_getValue(ini, "USpec", "RACF")
|
racf := ini_get(ini, "USpec", "RACF")
|
||||||
email := ini_getValue(ini, "USpec", "Email")
|
email := ini_get(ini, "USpec", "Email")
|
||||||
docfile := ini_getValue(ini, "USpec", "DocFile")
|
docfile := ini_get(ini, "USpec", "DocFile")
|
||||||
|
|
||||||
; General Settings
|
; General Settings
|
||||||
mansol := ini_getValue(ini, "Main", "Mansol")
|
mansol := ini_get(ini, "Main", "Mansol")
|
||||||
supadmin := ini_getValue(ini, "Main", "Supadmin")
|
supadmin := ini_get(ini, "Main", "Supadmin")
|
||||||
mjdpaste := ini_getValue(ini, "Main", "MJDPaste")
|
mjdpaste := ini_get(ini, "Main", "MJDPaste")
|
||||||
caseformatter := ini_getValue(ini, "Main", "CaseFormatter")
|
caseformatter := ini_get(ini, "Main", "CaseFormatter")
|
||||||
|
|
||||||
; Replacement
|
; Replacement
|
||||||
jdpn := ini_getValue(ini, "Replacement", "JDProductNames")
|
jdpn := ini_get(ini, "Replacement", "JDProductNames")
|
||||||
glovar := ini_getValue(ini, "Replacement", "GloVar")
|
glovar := ini_get(ini, "Replacement", "GloVar")
|
||||||
|
|
||||||
; Language
|
; Language
|
||||||
ger := ini_getValue(ini, "Language", "German")
|
ger := ini_get(ini, "Language", "German")
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; Global Variables
|
; Global Variables
|
||||||
@ -59,9 +57,9 @@ ger := ini_getValue(ini, "Language", "German")
|
|||||||
|
|
||||||
If (glovar = 1)
|
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:*:$dnm::`n:*:$dem::`n:*:$xid::`n"
|
glovarstart := "#SingleInstance force`n`n:*:$dorg::`n:*:$dus::`n:*:$dnm::`n:*:$dem::`n:*:$xid::`n"
|
||||||
|
|
||||||
SetTimer, GloVar, 2000 ; Check every 2 seconds
|
SetTimer, GloVar, 2000 ; Check every 2 seconds
|
||||||
|
|
||||||
@ -94,7 +92,7 @@ If (glovar = 1)
|
|||||||
StringUpper, REValue, REValue ; Makes it uppercase
|
StringUpper, REValue, REValue ; Makes it uppercase
|
||||||
WinWaitNotActive, GloVar.ini ; Just to make sure
|
WinWaitNotActive, GloVar.ini ; Just to make sure
|
||||||
{
|
{
|
||||||
ini_writeValue(glovarini, REKey, REValue)
|
ini_write(glovarini, REKey, REValue)
|
||||||
FileGetTime, gvMod, %glovarini%
|
FileGetTime, gvMod, %glovarini%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +103,7 @@ If (glovar = 1)
|
|||||||
StringUpper, REValue, REValue ; Makes it uppercase
|
StringUpper, REValue, REValue ; Makes it uppercase
|
||||||
WinWaitNotActive, GloVar.ini
|
WinWaitNotActive, GloVar.ini
|
||||||
{
|
{
|
||||||
ini_writeValue(glovarini, REKey, REValue) ; Writes the properly formatted case number to glovar.ini
|
ini_write(glovarini, REKey, REValue) ; Writes the properly formatted case number to glovar.ini
|
||||||
FileGetTime, gvMod, %glovarini%
|
FileGetTime, gvMod, %glovarini%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,14 +116,14 @@ If (glovar = 1)
|
|||||||
{
|
{
|
||||||
WinWaitNotActive, GloVar.ini
|
WinWaitNotActive, GloVar.ini
|
||||||
{
|
{
|
||||||
ini_writeValue(glovarini, REKey, REMatch) ; Writes the properly formatted case number to glovar.ini
|
ini_write(glovarini, REKey, REMatch) ; Writes the properly formatted case number to glovar.ini
|
||||||
FileGetTime, gvMod, %glovarini%
|
FileGetTime, gvMod, %glovarini%
|
||||||
}
|
}
|
||||||
REValue := REMatch
|
REValue := REMatch
|
||||||
} Else {
|
} Else {
|
||||||
WinWaitNotActive, GloVar.ini
|
WinWaitNotActive, GloVar.ini
|
||||||
{
|
{
|
||||||
ini_writeValue(glovarini, REKey, REValue) ; Writes the properly formatted case number to glovar.ini
|
ini_write(glovarini, REKey, REValue) ; Writes the properly formatted case number to glovar.ini
|
||||||
FileGetTime, gvMod, %glovarini%
|
FileGetTime, gvMod, %glovarini%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,13 +152,13 @@ If (glovar = 1)
|
|||||||
|
|
||||||
WinWaitNotActive, GloVar.ini
|
WinWaitNotActive, GloVar.ini
|
||||||
{
|
{
|
||||||
ini_writeValue(glovarini, "xID", REValue) ; Writes the xID entered, but uppercase
|
ini_write(glovarini, "xID", dealinfo.xid) ; Writes the xID
|
||||||
ini_writeValue(glovarini, "dem", dealinfo.email) ; Writes email address (incredibly useful)
|
ini_write(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_write(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_write(glovarini, "dus", dealinfo.user) ; Writes demo account name (somewhat useful)
|
||||||
|
ini_write(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
|
|
||||||
}
|
}
|
||||||
If (InStr(REKey, "dem") or InStr(REKey, "dnm") or InStr(REKey, "dus"))
|
If (InStr(REKey, "dem") or InStr(REKey, "dnm") or InStr(REKey, "dus"))
|
||||||
{
|
{
|
||||||
@ -179,19 +177,24 @@ If (glovar = 1)
|
|||||||
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"
|
||||||
|
|
||||||
writethis := "Case on " . CurrTime . "`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" . 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
|
FileAppend, % "`n`n`n`n" writethis "`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, 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
|
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
|
FileDelete, glovar.ahk ; THE CLEAN SLATE
|
||||||
FileAppend, %glovarstart%, glovar.ahk
|
FileAppend, %glovarstart%, glovar.ahk
|
||||||
|
|
||||||
Sleep, 500
|
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
|
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")
|
||||||
{
|
{
|
||||||
Run glovar.ahk
|
Run glovar.ahk
|
||||||
}
|
}
|
||||||
Break
|
Return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} Until (file.AtEOF)
|
} Until (file.AtEOF)
|
||||||
|
38
Settings.ahk
38
Settings.ahk
@ -9,21 +9,21 @@ This is the part that reads the file to see what your settings are. Variables in
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
; User Specific things:
|
; User Specific things:
|
||||||
racf := ini_getValue(ini, "USpec", "RACF")
|
racf := ini_get(ini, "USpec", "RACF")
|
||||||
email := ini_getValue(ini, "USpec", "Email")
|
email := ini_get(ini, "USpec", "Email")
|
||||||
docfile := ini_getValue(ini, "USpec", "DocFile")
|
docfile := ini_get(ini, "USpec", "DocFile")
|
||||||
|
|
||||||
; General Settings
|
; General Settings
|
||||||
mansol := ini_getValue(ini, "Main", "Mansol")
|
mansol := ini_get(ini, "Main", "Mansol")
|
||||||
mjdpaste := ini_getValue(ini, "Main", "MJDPaste")
|
mjdpaste := ini_get(ini, "Main", "MJDPaste")
|
||||||
caseformatter := ini_getValue(ini, "Main", "CaseFormatter")
|
caseformatter := ini_get(ini, "Main", "CaseFormatter")
|
||||||
|
|
||||||
; Replacement
|
; Replacement
|
||||||
jdpn := ini_getValue(ini, "Replacement", "JDProductNames")
|
jdpn := ini_get(ini, "Replacement", "JDProductNames")
|
||||||
glovar := ini_getValue(ini, "Replacement", "GloVar")
|
glovar := ini_get(ini, "Replacement", "GloVar")
|
||||||
|
|
||||||
; Language
|
; Language
|
||||||
ger := ini_getValue(ini, "Language", "German")
|
ger := ini_get(ini, "Language", "German")
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; Create GUI
|
; Create GUI
|
||||||
@ -83,12 +83,12 @@ write the state of the check box (a 0 for unchecked, 1 for checked), to the file
|
|||||||
|
|
||||||
RACF:
|
RACF:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "RACF", formRACF)
|
ini_write(ini, "RACF", formRACF)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Email:
|
Email:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "Email", formEmail)
|
ini_write(ini, "Email", formEmail)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
DocFile:
|
DocFile:
|
||||||
@ -97,39 +97,39 @@ DocFile:
|
|||||||
if SelectedFile =
|
if SelectedFile =
|
||||||
MsgBox, You have not selected a file, this will break some things.
|
MsgBox, You have not selected a file, this will break some things.
|
||||||
else
|
else
|
||||||
ini_writeValue(ini, "DocFile", SelectedFile)
|
ini_write(ini, "DocFile", SelectedFile)
|
||||||
docfile := ini_getValue(ini, "USpec", "DocFile")
|
docfile := ini_get(ini, "USpec", "DocFile")
|
||||||
Gui, Show, h225 w295, David 3000 Settings
|
Gui, Show, h225 w295, David 3000 Settings
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Mansol:
|
Mansol:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "Mansol", formMansol)
|
ini_write(ini, "Mansol", formMansol)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
MJDPaste:
|
MJDPaste:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "MJDPaste", formMJDPaste)
|
ini_write(ini, "MJDPaste", formMJDPaste)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
CaseFormatter:
|
CaseFormatter:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "CaseFormatter", formCaseFormatter)
|
ini_write(ini, "CaseFormatter", formCaseFormatter)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Jdpn:
|
Jdpn:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "JDProductNames", formJdpn)
|
ini_write(ini, "JDProductNames", formJdpn)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Glovar:
|
Glovar:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "GloVar", formGlovar)
|
ini_write(ini, "GloVar", formGlovar)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Ger:
|
Ger:
|
||||||
Gui, Submit, NoHide
|
Gui, Submit, NoHide
|
||||||
ini_writeValue(ini, "German", formGer)
|
ini_write(ini, "German", formGer)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Help:
|
Help:
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
csv = %A_MyDocuments%\Work_Docs\emails.csv ; Where the email CSV is
|
csv = %A_MyDocuments%\Work_Docs\emails.csv ; Where the email CSV is
|
||||||
|
|
||||||
glovarini := A_MyDocuments "\GloVar.ini"
|
glovarini := A_MyDocuments "\GloVar.ini"
|
||||||
Xid := ini_getValue(glovarini, "Info", "xID")
|
Xid := ini_get(glovarini, "Info", "xID")
|
||||||
StringUpper, Xid, Xid
|
|
||||||
|
|
||||||
Gui, +AlwaysOnTop +ToolWindow
|
Gui, +AlwaysOnTop +ToolWindow
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ ButtonOK:
|
|||||||
Gui, Submit
|
Gui, Submit
|
||||||
writethis := Xid . "," . Email . "," . Name
|
writethis := Xid . "," . Email . "," . Name
|
||||||
FileAppend, % "`n" writethis, %csv%
|
FileAppend, % "`n" writethis, %csv%
|
||||||
ini_writeValue(A_MyDocuments "\GloVar.ini", "dem", Email)
|
ini_write(A_MyDocuments "\GloVar.ini", "dem", Email)
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
35
func.ahk
35
func.ahk
@ -10,7 +10,7 @@ ini = %A_MyDocuments%\D3Ksettings.ini ; Where the settings ini is
|
|||||||
GetDateTime(lang)
|
GetDateTime(lang)
|
||||||
{
|
{
|
||||||
UTCTimestamp := A_NowUTC ; Grab the current time and date
|
UTCTimestamp := A_NowUTC ; Grab the current time and date
|
||||||
UTCFormatStr := "yyyy-MM-dd" ; This is what we want it to look like
|
UTCFormatStr := "yyyy-MM-dd" ; The Date
|
||||||
FormatTime, DateStr, %UTCTimestamp%, %UTCFormatStr% ; format it to make it look like the Date we want
|
FormatTime, DateStr, %UTCTimestamp%, %UTCFormatStr% ; format it to make it look like the Date we want
|
||||||
UTCFormatStr := "H:mm' GMT'" ; The time
|
UTCFormatStr := "H:mm' GMT'" ; The time
|
||||||
FormatTime, TimeStr, %UTCTimestamp%, %UTCFormatStr% ; Format the string to be better
|
FormatTime, TimeStr, %UTCTimestamp%, %UTCFormatStr% ; Format the string to be better
|
||||||
@ -25,22 +25,28 @@ GetDateTime(lang)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInfo(xID) ; Accept what is passed here as the variable "xID" in the script
|
GetInfo(xID)
|
||||||
{
|
{
|
||||||
if (xID)
|
if (xID)
|
||||||
{
|
{
|
||||||
Loop, Read, %A_MyDocuments%\Work_Docs\emails.csv ; read every line of "emails.csv"
|
File := FileOpen(A_MyDocuments "\Work_Docs\emails.csv", "r")
|
||||||
|
Loop
|
||||||
{
|
{
|
||||||
Array := StrSplit(A_LoopReadLine,",") ; split the line at its separating commas to get separate "columns" AKA elements
|
Line := File.ReadLine()
|
||||||
if InStr(Array[1],xID) ; if at the specified element (1) the specified content (dealers xID) has been found,
|
Array := StrSplit(Line,",") ; split the line at its separating commas to get separate "columns" AKA elements
|
||||||
Break ; stop searching
|
if InStr(Array[1], xID) ; if at the specified element (1) the specified content (dealers xID) has been found
|
||||||
|
{
|
||||||
|
Test := {xid: Array[1], email: Array[2], name: Array[3], user: Array[4], org: Array[5]} ; Return the array so we can do {variable}.email and so on
|
||||||
|
File.Close() ; Close the file
|
||||||
|
Return Test ; Return the array with the deets that we found
|
||||||
}
|
}
|
||||||
Test:= {xid: Array[1], email: Array[2], name: Array[3], user: Array[4], org: Array[5]} ; Return the array so we can do {variable}.email and so on
|
} Until (File.AtEOF)
|
||||||
Return Test
|
File.Close()
|
||||||
|
Return false
|
||||||
}
|
}
|
||||||
if !(xID)
|
if !(xID)
|
||||||
{
|
{
|
||||||
Return
|
Return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +81,7 @@ ini_load(location)
|
|||||||
Return out
|
Return out
|
||||||
}
|
}
|
||||||
|
|
||||||
ini_getValue(location, inSec, inKey)
|
ini_get(location, inSec, inKey)
|
||||||
{
|
{
|
||||||
ini_loaded := {}
|
ini_loaded := {}
|
||||||
ini_loaded := ini_load(location)
|
ini_loaded := ini_load(location)
|
||||||
@ -83,10 +89,15 @@ ini_getValue(location, inSec, inKey)
|
|||||||
inSec := StrReplace(inSec, " ", "_")
|
inSec := StrReplace(inSec, " ", "_")
|
||||||
inKey := StrReplace(inKey, " ", "_")
|
inKey := StrReplace(inKey, " ", "_")
|
||||||
|
|
||||||
Return ini_loaded[inSec][inKey]
|
needed := ini_loaded[inSec][inKey]
|
||||||
|
|
||||||
|
if (needed) ; Without this it doesn't know what to return and gets stuck
|
||||||
|
{
|
||||||
|
Return needed
|
||||||
|
} Else Return false
|
||||||
}
|
}
|
||||||
|
|
||||||
ini_writeValue(location, inKey, inValue)
|
ini_write(location, inKey, inValue)
|
||||||
{
|
{
|
||||||
FileRead, tempini, %location%
|
FileRead, tempini, %location%
|
||||||
needle := inKey . "=.*"
|
needle := inKey . "=.*"
|
||||||
|
Loading…
Reference in New Issue
Block a user