How to? Renaming files using information inside the file?

I've got a folder full of TXT story files with the actual story title and author are on the second and third lines of the file.

For example, the file Carl-APsalter.txt begins with:
The Avalon Psalter
by Lillian Stewart Carl

What I want to do is to either:
A: get a list of file names and headers in a format that I can then edit into rename commands using a textpad macro

The Avalon Psalter
by Lillian Stewart Carl

Note: I can get a list of the file names OR a list of the header information,
but not both at the same time. A "FOR ... echo | head )doesn't work.

Even better, though, would be some way to build and execute the following command
for each file:

rename Carl-APsalter.txt "Lillian Stewart Carl - The Avalon Psalter.txt"

Any help appreciated. I only have to do this once but getting it to work is driving me nuts.
Thanks in advance.
md Processed
for %fn in (*.txt) (
  set line2=%@line[%fn,1]
  set line3=%@line[%fn,2]
  set cAuthor=%@right[-4,%line3]
  copy /q "%fn" "Processed\%[cAuthor] - @line2.txt"
echo Newly named files are in Processed folder....


Scott Mintz
May 20, 2008
Solon, OH, USA
As Klaus suggested, use DO instead of FOR. It'll make debugging substantially easier.
do f in *.txt (ren %f "%@right[-3,%@line[%f,2]] - %@line[%f,1].*")