-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathMakeNightlyCsvsFromIni.ahk
More file actions
38 lines (33 loc) · 1013 Bytes
/
MakeNightlyCsvsFromIni.ahk
File metadata and controls
38 lines (33 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include FcnLib.ahk
#include FcnLib-Rewrites.ahk
ini:=GetPath("NightlyStats.ini")
csv:=GetPath("FinancialPast.csv")
date:=CurrentTime("hyphendate")
CreateCSV(ini, csv, "SavingsBalance,CheckingBalance,CameronBalance,MelindaBalance,OverallBalance")
;make a csv from the data in the ini
;date is automatically prepended to the headings
CreateCSV(ini, csv, headings)
{
sections:=IniListAllSections(ini)
;debug(sections, date)
;Print Headings in new CSV file
FileDelete(csv)
csvline:=ConcatWithSep(",", "Date", headings)
FileAppendLine(csvline, csv)
;Loop per day
Loop, parse, sections, CSV
{
section:=A_LoopField
csvline:=section
;Get each value in the line
Loop, parse, headings, CSV
{
heading:=A_LoopField
value:=IniRead(ini, section, heading)
if (value == "ERROR")
value=
csvline:=ConcatWithSep(",", csvline, value)
}
FileAppendLine(csvline, csv)
}
}