Uniquely identifying layers, even with the same name, or after changing names
I'm sure many have tried it, but I'm taking a crack at the ol' "Get Layer Comps working in Illustrator (CS5.5)" script. The one thing that I'm currently unsure of, though, is how to uniquely identify each layer in a way that I can serialize. Currently, I'm writing an XML sidecar file, though I'll probably add an option for XMP tags once I know it works.
Anyhow my problem: As far as I can tell, there's no sort of internal identifier that I can access, short of the name-- which has the problem that it's not unique, and it doesn't stick if you change the name.
Barring an actual unique-ID, I did have one tricky idea up my sleeve-- I could use the layer selection color as a fallback. Before generating a snapshot for the first time, I could subtly tweak the RGB values for all the layer selection colors-- just one or two degrees, so they're all unique, and not the presets. Then, when I load in snapshots, I can use those RGB values as a secondary verifier, if there are unknown layers, or if there are two layers with the same name.
EDIT:
Actually, I just realized that wouldn't work. If you copy the layer, it retains the unique color. So, I think that barring an actual unique-ID tag I don't know about, I might just offer the option of either requiring uniqueness and never changing, or tagging layer names with an ID.
