If you have the need to count how many files in a folder have something in their name, or like to save files with the same name but append a number after them, this macro will help.
As an example, if you have a macro that will save a file called 'Big Store.pdf' to a folder, but if one or more files with that name already exist, this macro can be run first to find out how may files exist with a specified name and then append the returned number after it.
Big Store.pdf
Big Store 2.pdf
Big Store 3.pdf
I use it by having a primary macro set a variable (DestinationPath) to the full path of the location I am saving the file to and then execute this macro. This macro then returns the results by setting a fileCount variable. If the fileCount is is zero I know the file name is unique. If it is greater then zero, I append the returned number (fileCount) + 1 to the end of the file name.
Here is the Macro you can download and import:
File Name Repetition Count.kmmacros (5.6 KB)