Export layers to files only works when you give the file a name first.
I always got the error message 'Error: The requested action requires that the target document is the frontmost document.' when trying to export multiple layers to files. I figured out that you have to give your PSD file a name first (and save it) before this script works. Photoshop should know this and tell the user he has to give it a name first and save it.
The error message is not helping at all, since the document was the only open document.
