Quote from Mark Waples on February 27, 2020, 1:45 pmHi is anyone able to point me in the right direction please?
I am looking to loop through a list of files and perform and action on the list of files.
I cannot see how to perform a "loop for each" as that action does not exist.
TIA
Mark
Hi is anyone able to point me in the right direction please?
I am looking to loop through a list of files and perform and action on the list of files.
I cannot see how to perform a "loop for each" as that action does not exist.
TIA
Mark
Quote from Gaev on February 27, 2020, 2:41 pm@mark-waples
I am looking to loop through a list of files and perform and action on the list of files.
I cannot see how to perform a "loop for each" as that action does not exist.You did not elaborate on the form/format of the list of files ... so I am going to assume that you used something like ...
FileList "C:\My Photos\*.jpg" "Files" "[Pics]"... now, [Pics] will contain the names (separated by carriage returns i.e. [#13]) ... so you do something like ...
StrParse "[Pics]" "[#13]" "[Names]" "[Count]"... to get the file names in variables [Names1], [Names2], ... [Names143] etc. ... [count] tells you how many such variables were created.
Finally, you process each entry using the Loop/EndLoop code block ...
Loop "1" "[count]" "[thisEntry]" SetVar "[thisFileName] "[Names[thisEntry]]" ... enter you script actions for this File Name here e.g. AlertBox "File Name" "File [thisEntry] of [count] is called [thisFilename]" EndLoop
I am looking to loop through a list of files and perform and action on the list of files.
I cannot see how to perform a "loop for each" as that action does not exist.
You did not elaborate on the form/format of the list of files ... so I am going to assume that you used something like ...
FileList "C:\My Photos\*.jpg" "Files" "[Pics]"
... now, [Pics] will contain the names (separated by carriage returns i.e. [#13]) ... so you do something like ...
StrParse "[Pics]" "[#13]" "[Names]" "[Count]"
... to get the file names in variables [Names1], [Names2], ... [Names143] etc. ... [count] tells you how many such variables were created.
Finally, you process each entry using the Loop/EndLoop code block ...
Loop "1" "[count]" "[thisEntry]" SetVar "[thisFileName] "[Names[thisEntry]]" ... enter you script actions for this File Name here e.g. AlertBox "File Name" "File [thisEntry] of [count] is called [thisFilename]" EndLoop
Quote from Mark Waples on February 27, 2020, 4:05 pm@gaev
Many thanks - I ended up with this and it works perfectly.
FolderBox "Select a Folder:" "[FOLDERS]" FileList "[FOLDERS]\*.*" "Files" "[FILELIST]" StrParse "[FILELIST]" "[#13]" "[Names]" "[Count]" Loop "1" "[count]" "[thisEntry]" SetVar "[thisFileName]" "[Names[thisEntry]]" ... enter you script actions for this File Name here e.g. dbpImportFromCSV "main" "Table1" "[PubDir]\SplitFiles\[thisFileName]" "Delimiter=,;ContainsFieldNames=No;MatchFieldNames=No" Balloon "IMPORTING...|PLEASE BE PATIENT!||IMPORTING FILE:||File [thisEntry] of [count] - [thisFilename]" "-1" "-1" "2000" EndLoopThanks again - very helpful! :)
Many thanks - I ended up with this and it works perfectly.
FolderBox "Select a Folder:" "[FOLDERS]" FileList "[FOLDERS]\*.*" "Files" "[FILELIST]" StrParse "[FILELIST]" "[#13]" "[Names]" "[Count]" Loop "1" "[count]" "[thisEntry]" SetVar "[thisFileName]" "[Names[thisEntry]]" ... enter you script actions for this File Name here e.g. dbpImportFromCSV "main" "Table1" "[PubDir]\SplitFiles\[thisFileName]" "Delimiter=,;ContainsFieldNames=No;MatchFieldNames=No" Balloon "IMPORTING...|PLEASE BE PATIENT!||IMPORTING FILE:||File [thisEntry] of [count] - [thisFilename]" "-1" "-1" "2000" EndLoop
Thanks again - very helpful! :)