AppleScript for get info [Full font name]

I am trying to put together a catalog of fonts. There are quite a few (2000 plus). Obviously there are many ways to do this, but I have decided on using a little perl script to create an HTML file with all of the fonts. This works great except in order to use the font-family attribute I need the actual font name, not the filename of the otf file, which is what I have. I see that the get info window displays this under general > Full name:

What I would like to write is an applescript that will get this (the full name) for each file, and preferably output it to a text file, each on its own line. If I can do that then I can just plug that into the perl script I already have to create my html file.

Model: Mac Pro
Browser: Safari 522.12.1
Operating System: Mac OS X (10.4)


if the fonts are installed in Font, you can gather the data from there.
It takes some time, because the “full name” must composed of family name and style name.
The result is a text file theFonts.txt on your desktop

set theFonts to {}
tell application "Font Book"
	repeat with i in (get typefaces)
		set end of theFonts to family name of i & space & style name of i
	end repeat
end tell
set {TID, text item delimiters} to {text item delimiters, return}
set theFonts to theFonts as string
set text item delimiters to TID
	set ff to open for access file ((path to desktop as Unicode text) & "theFonts.txt") with write permission
	write theFonts to ff
	close access ff
on error
		close access file target
	end try
end try

Unfortunately, I have many more fonts installed than the ones going in this catalogue. I however only want to make these 2000 into the catalog. Maybe I could drop these into a group, and just run the script on that. Thanks. It would still be nice to get this straight from the file instead of from fontbook, since each style is its own file.

Something to consider:

choose file with prompt "Choose a font file:" default location (path to fonts folder from system domain) without invisibles
quoted form of POSIX path of result

do shell script "/usr/bin/mdls -name kMDItemFonts " & result & " | /usr/bin/grep --only-matching '(.*$'"

as far as I know it’s impossible to get the information neither by spotlight metadata nor by the Finder.
AppleScript has no access to the displayed full name in the information window (btw it would take hours to open and close in info windows of all fonts)
Using a group change this line

repeat with i in (get typefaces of font collection "myCollection")

That was my first thought, too. But unfortunately it doesn’t work e.g. with Adobe OpenType fonts

I have to generate a list of metadata for over 9500 individual faces on a daily basis and did it by using Suitcase’s ability to see font metadata. I seem to recall that trying to extract the metadata via hexdump and grep didn’t pan-out. So I have AppleScript poll Suitcase overnight and trudge through every font and put the data into an Excel spreadsheet. Currently takes 24 minutes on a Dual 1.8 GHz G5 running OS X 10.4.10 and Suitcase