Skip to content

Commit

Permalink
update demo script for multiple reuses
Browse files Browse the repository at this point in the history
  • Loading branch information
JnLlnd committed Feb 27, 2022
1 parent c597586 commit 441d9ee
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
45 changes: 43 additions & 2 deletions ObjCSV-Demo-ReusedFields.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ 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 := A_ScriptDir . "\TheBeatles-ReusedFields.txt"
strFields := "lng_Track_Number,strNameAndGenre,""[[#[lng_Track_Number]: [strNameAndGenre]][strNoNameGenre]]"""
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 := "")
Expand All @@ -32,3 +35,41 @@ 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
2 changes: 1 addition & 1 deletion TheBeatles-ReuseLoad.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
str_Name,str_Album,lng_Track_Number,str_Genre,lng_Total_Time,lng_Size,"[[[str_Name] ([str_Genre])][strNameAndGenre]]"
str_Name,str_Album,[[Album: [str_Album] / Song: [str_Name]][str_AlbumName]],lng_Track_Number,str_Genre,lng_Total_Time,lng_Size,[[#[lng_Track_Number] [str_AlbumName]][str_TrackAlbumName]]
"Hey Jude - Sgt. Pepper's Lonely Hearts Club Band (Reprise) (LOVE)",LOVE,24,Pop,320914,5159544
March Of The Meanies,Yellow Submarine,11,Soundtrack,139415,3388931
Tell Me What You See,Help!,11,Pop,158040,3840243
Expand Down

0 comments on commit 441d9ee

Please sign in to comment.