Looping through filenames not working

I am using a macro that I found on one of these forums to copy the selected file names to the clipboard. The macro correctly retrieves the file paths but the loop below does not work but just saves the last file name to the clipboard.


What am I missing?

What is your objective?

If you want to process each file that is found, then just ADD the Actions at the bottom of the For Each Loop:


If you just want a list of the file names, then insert this Action AFTER the Split Path Action:


Here's the text of the Action:

And then at the bottom of the macro, you can use the variable "Local__FileNameList" to display, save, or whatever you'd like.

Thanks @JMichaelTX. That worked.

I don't understand why my macro did not work though. I expected the macro to loop through the for next loop for each file in the list and save that filename to the clipboard on each loop.

I suspect it was doing exactly that. However, ONLY the last filename would be on the current Clipboard. If you view KM's Clipboard History Switcher, you will probably see all of the other fine names on prior clipboards.

Okay. Thanks for the explanation.