I have a folder which contains a number of text files. I would like to have a loop where it reads the contents of those text files into the clipboard, one at a time (so I can process each one). So, I am thinking something along the lines of a For Each command.
Is this possible with KM? I’ve no idea how to do the cycling!
February 12, 2016, 5:42pm
Be more specific about the processing process.
Reading the files is easy, but how you’re processing makes all the difference in how to go about it.
File > For Each Path in Folder
This will get you the path to each file.
Then you can use the actions something like this macro to process each file:
MACRO: [FILE] Process Lines in Text File
Hey Chris, this is what I mean…
A folder contains say 100 text files. So I want a loop that:
Reads the first text file contents into the clipboard. (I have code that then does stuff to the clipboard contents)
Read the second text file contents into the clipboard.
Read the third text…you get the drift!
The loop ends when there are no more text files in the folder.
February 13, 2016, 3:26pm
this is what I mean...
Oh, you're still working on the same problem.
Well, maybe something like this:
Generic-Test 01.kmmacros (4.6 KB)
I've got this set up for manual processing: read the file, pause for user actions.
A second macro changes the variable
macroContinues to “Go”, and another iteration starts.
When all files are processed an alert sound goes off.
I know this is not precisely what you're trying to do, but it should give you some idea of how to proceed.
Thanks Chris. It has given me a better idea how the For Each Item in a Collection action works. I can hopefully move forward now. Quick question, why did you put a “.” before /Split_Files/ ?
And yes, I am working at the weekend!
February 13, 2016, 5:26pm
could have written it “Split_Files/”
The dot means current directory, and that notation is more clear to me at a glance.