GetComponents Unique List

I'm looking to modify a macro to assign colors to parts (Paint A Rainbow On Your SolidWorks Assembly. Multi-Colored Macro Follow-up. - SolidSmack - ) to color all identical parts the same rather than just assign a new color to each part. Is there a good method to create a list of all the unique parts rather than every part as GetComponents does?

Thanks.

SolidworksApi macros