Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Need script to export custom text in all fonts in a collection in Font Book

Hi


I am wondering if it would be possible to write an applescript to export sample text for every font in a collection in the Font Book application to a TextEdit document, with each sample text on a new line?


If anyone has such a script or could help me get going to write one I'd be grateful,


Thanks,


Nick

Macbook Pro, Mac OS X (10.6.6), 2.66 GHz Intel Core i7 8GB RAM

Posted on Jun 9, 2011 4:46 AM

Reply
Question marked as Best reply

Posted on Jun 9, 2011 9:32 AM

This should do what you want:


tell application "Font Book"

set fontCollectionNames to name of every font collection

set collectionName to item 1 of (choose from list fontCollectionNames with prompt "Choose a font collection")

set fontNames to name of every font family of font collectioncollectionName

end tell


set exampleText to ""

repeat (count of fontNames) times

set exampleText to exampleText & "This is my example text" & return

end repeat


tell application "TextEdit"

activate

set theDoc to makenewdocument

set text of theDoc to exampleText

repeat with i from 1 to (count of fontNames)

set font of paragraph i of text of theDoc to (item i of fontNames)

end repeat

end tell

2 replies
Question marked as Best reply

Jun 9, 2011 9:32 AM in response to nick_harambee

This should do what you want:


tell application "Font Book"

set fontCollectionNames to name of every font collection

set collectionName to item 1 of (choose from list fontCollectionNames with prompt "Choose a font collection")

set fontNames to name of every font family of font collectioncollectionName

end tell


set exampleText to ""

repeat (count of fontNames) times

set exampleText to exampleText & "This is my example text" & return

end repeat


tell application "TextEdit"

activate

set theDoc to makenewdocument

set text of theDoc to exampleText

repeat with i from 1 to (count of fontNames)

set font of paragraph i of text of theDoc to (item i of fontNames)

end repeat

end tell

Need script to export custom text in all fonts in a collection in Font Book

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.