Here's a simple script that will generate color rectangles in a document for every color in the main swatch palette.
Suppose that you want to create a visual legend of some colors. This script will make a map of ALL the swatches in the documents swatch palette. (If you want to skip the "none" and "registration" values, just edit the script so the "for" loop start at 2 instead of 0.)
Just run this script, and a legend of named swatch rectangles with (by default) their CMYK values will appear in a nicely grouped object on the top of your document.
Sound off in the comments if you find this one useful.