The subject says it all...I know I can automate from the file menu, but it looks at multiple files in a directory. I have a single PSD file with 30 layers and I want to make a contact sheet from those layers...is there a way to automate it?
This will work great if every layer fills the canvas:
file >>scripts >> export layers to files
then you can run contact sheet on the files it generates.
If you have small objects than do not fill the entire canvas, you will get all the white space around it in the contact sheet results. You could though open each file control click on the layer to select all pixels then crop (you could make an action to do this if you have a huge job).