Vertex Color to Color ID is a commercial maxscript tool designed for assigning Color IDs for Substance 3D Painter.
Install and usage