-
Notifications
You must be signed in to change notification settings - Fork 12
/
ObjCSV-Demo-ReusedFields.ahk
75 lines (57 loc) · 2.54 KB
/
ObjCSV-Demo-ReusedFields.ahk
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;===============================================
/*
ObjCSVTest Combine Fields
*/
#NoEnv
#SingleInstance, force
Gosub, LoadFile
Gosub, SaveFile
ExitApp
LoadFile:
strFile := A_ScriptDir . "\TheBeatles-ReuseLoad.txt"
MsgBox, 4, Display INPUT file?, Input file:`n`n%strFile%`n`nDisplay file?
IfMsgBox, Yes
Run %strFile%
strFields := ""
obj := ObjCSV_CSV2Collection(strFile, strFields, , , , , , , , , "[]") ; load the CSV file to a collection of objects
return
SaveFile:
strFile := StrReplace(strFile, ".txt", "-OUTPUT.txt")
strFields := "str_Name,str_Album,str_AlbumName,lng_Track_Number,str_Genre,lng_Total_Time,lng_Size,str_TrackAlbumName"
; ObjCSV_Collection2CSV(objCollection, strFilePath, blnHeader := 0, strFieldOrder := "", intProgressType := 0
; , blnOverwrite := 0, strFieldDelimiter := ",", strEncapsulator := """", strEolReplacement := ""
; , strProgressText := "", strFileEncoding := "", blnAlwaysEncapsulate := 0, strEol := "", strReuseDelimiters := "")
ObjCSV_Collection2CSV(obj, strFile, 1, strFields, , 1, , , , , , , , "[]") ; save the collection of objects to a CSV file and overwrite this file
MsgBox, 4, Display file?, File saved:`n`n%strFile%`n`nDisplay file?
IfMsgBox, Yes
Run %strFile%
return
/*
;===============================================
; ObjCSVTest Combine Fields SIMPLE
#NoEnv
#SingleInstance, force
Gosub, LoadFile
Gosub, SaveFile
ExitApp
LoadFile:
; strFile := A_ScriptDir . "\..\..\CSVBuddy\TEST-Reuse-One-Simple.csv"
; strFile := A_ScriptDir . "\..\..\CSVBuddy\Reuse-None-Simple.csv"
strFile := A_ScriptDir . "\..\..\CSVBuddy\Reuse-Double-Simple.csv"
MsgBox, 4, Display INPUT file?, Input file:`n`n%strFile%`n`nDisplay file?
IfMsgBox, Yes
Run %strFile%
strFields := ""
obj := ObjCSV_CSV2Collection(strFile, strFields, , , , , , , , , "[]") ; load the CSV file to a collection of objects
return
SaveFile:
strFile := StrReplace(strFile, ".csv", "-OUTPUT.csv")
strFields := "F1&2,[[[F1&2][F1&2]][F1&2 Doubled]],F1&2&3,F3,[[[F1&2&3][F1&2&3]][F1&2&3 Doubled]]"
; ObjCSV_Collection2CSV(objCollection, strFilePath, blnHeader := 0, strFieldOrder := "", intProgressType := 0
; , blnOverwrite := 0, strFieldDelimiter := ",", strEncapsulator := """", strEolReplacement := ""
; , strProgressText := "", strFileEncoding := "", blnAlwaysEncapsulate := 0, strEol := "", strReuseDelimiters := "")
ObjCSV_Collection2CSV(obj, strFile, 1, strFields, , 1, , , , , , , , "[]") ; save the collection of objects to a CSV file and overwrite this file
MsgBox, 4, Display OUTPUT file?, File saved:`n`n%strFile%`n`nDisplay file?
IfMsgBox, Yes
Run %strFile%
return