diff --git a/func.ahk b/func.ahk index 8b0036b..0154f16 100644 --- a/func.ahk +++ b/func.ahk @@ -30,14 +30,24 @@ GetInfo(xID) ; Accept what is passed here as the variable "xID" in the script if (xID) { csv := FileOpen(A_MyDocuments "\Work_Docs\emails.csv", "r") - Loop { + if RegExMatch(csv.Read, xID) + { + Loop { ReadLine := csv.ReadLine() Array := StrSplit(ReadLine,",") - } Until InStr(Array[1], xID) - csv.Close() - 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 - } Else Return false + } Until InStr(Array[1], xID) + csv.Close() + 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 + } Else + { + Return Test.xid := "0" + } + } + if !(xID) + { + Return Test.xid := "0" + } } SetInfo(xID, column, value) @@ -68,7 +78,7 @@ SetInfo(xID, column, value) { tempcsv .= Dealinfo[k].xid . "," . Dealinfo[k].email . "," . Dealinfo[k].name . "," . Dealinfo[k].user . "," . Dealinfo[k].org } - csv := A_MyDocuments . "\Work_Docs\emails-test.csv" + csv := A_MyDocuments . "\Work_Docs\emails.csv" FileAppend, %tempcsv%, tempcsv FileCopy, tempcsv, %csv%, 1 FileDelete, tempcsv