abandoning csv modification project

This commit is contained in:
2020-02-03 02:54:31 -06:00
parent 2bf4b8e8a9
commit c3c2da7120
4 changed files with 75 additions and 62 deletions

View File

@@ -10,7 +10,7 @@ ini = %A_MyDocuments%\D3Ksettings.ini ; Where the settings ini is
GetDateTime(lang)
{
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
UTCFormatStr := "H:mm' GMT'" ; The time
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)
{
Loop, Read, %A_MyDocuments%\Work_Docs\emails.csv ; read every line of "emails.csv"
File := FileOpen(A_MyDocuments "\Work_Docs\emails.csv", "r")
Loop
{
Line := File.ReadLine()
Array := StrSplit(Line,",") ; split the line at its separating commas to get separate "columns" AKA elements
if InStr(Array[1], xID) ; if at the specified element (1) the specified content (dealers xID) has been found
{
Array := StrSplit(A_LoopReadLine,",") ; split the line at its separating commas to get separate "columns" AKA elements
if InStr(Array[1],xID) ; if at the specified element (1) the specified content (dealers xID) has been found,
Break ; stop searching
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
Return Test
} Until (File.AtEOF)
File.Close()
Return false
}
if !(xID)
{
Return
Return false
}
}
@@ -75,7 +81,7 @@ ini_load(location)
Return out
}
ini_getValue(location, inSec, inKey)
ini_get(location, inSec, inKey)
{
ini_loaded := {}
ini_loaded := ini_load(location)
@@ -83,10 +89,15 @@ ini_getValue(location, inSec, inKey)
inSec := StrReplace(inSec, " ", "_")
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%
needle := inKey . "=.*"
@@ -97,4 +108,4 @@ ini_writeValue(location, inKey, inValue)
FileAppend, %tempini%, tempini ; Append the fixed ini to a new file
FileCopy, tempini, %location%, 1 ; Copy the file over, overwriting existing contents
FileDelete, tempini ; Delete the fixed temporary ini
}
}