do shell script "echo > " & quoted form of POSIX path of ((path to desktop as string) & "Active Fonts.txt")
do shell script "echo > " & quoted form of POSIX path of ((path to desktop as string) & "Inactive Fonts.txt")
tell application "Font Book"
set activeFontsList to name of every font family whose enabled is true
repeat with thisActiveFont in activeFontsList
do shell script "echo " & quoted form of thisActiveFont & " >> " & quoted form of POSIX path of ((path to desktop as string) & "Active Fonts.txt")
end repeat
set inactiveFontsList to name of every font family whose enabled is false
repeat with thisInactiveFont in inactiveFontsList
do shell script "echo " & quoted form of thisInactiveFont & " >> " & quoted form of POSIX path of ((path to desktop as string) & "Inactive Fonts.txt")
end repeat
end tell
Here’s a slightly faster version of blend3’s script:
tell application "Font Book" to set {fontNames, fontEnableds} to {name, enabled} of font families
set activeFontsList to {}
set inactiveFontsList to {}
repeat with i from 1 to (count fontEnableds)
if (item i of fontEnableds) then
set end of activeFontsList to item i of fontNames
else
set end of inactiveFontsList to item i of fontNames
end if
end repeat
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to linefeed
set activeFontsList to activeFontsList as text
set inactiveFontsList to inactiveFontsList as text
set AppleScript's text item delimiters to astid
set desktopPath to (path to desktop as text)
writeFile of activeFontsList to (desktopPath & "Active Fonts.txt")
writeFile of inactiveFontsList to (desktopPath & "Inactive Fonts.txt")
on writeFile of txt to destPath
set accessRef to (open for access file destPath with write permission)
try
set eof accessRef to 0
write txt to accessRef as «class utf8»
end try
close access accessRef
end writeFile
I took some liberties with Nigel’s script, as it is still not so fast, (but probably can’t be much faster) and incorporated StefanK’s SKProgressBar, so you can see that something is happening, and realize when the operation is done.
-- StefanK's SKProgressBar: http://macscripter.net/viewtopic.php?pid=160302#p160302
-- DJ Bazzie Wazzie SKProgressBar code http://macscripter.net/viewtopic.php?id=40763
tell application "SKProgressBar"
set floating to true
set position to {600, 550}
set width to 300.0
set title to "Gathering Font Data"
set header to "Searching.."
set header alignment to left
set footer to "Determining active and inactive Fonts."
set footer alignment to right
set show window to true
tell progress bar
activate
set indeterminate to true
start animation
end tell
end tell
tell application "Font Book" to set {fontNames, fontEnableds} to {name, enabled} of font families
set activeFontsList to {}
set inactiveFontsList to {}
repeat with i from 1 to (count fontEnableds)
if (item i of fontEnableds) then
set end of activeFontsList to item i of fontNames
else
set end of inactiveFontsList to item i of fontNames
end if
end repeat
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to linefeed
set activeFontsList to activeFontsList as text
set inactiveFontsList to inactiveFontsList as text
set AppleScript's text item delimiters to astid
set desktopPath to (path to desktop as text)
writeFile of activeFontsList to (desktopPath & "Active Fonts.txt")
writeFile of inactiveFontsList to (desktopPath & "Inactive Fonts.txt")
tell application "SKProgressBar"
stop animation
set show window to false
quit
end tell
on writeFile of txt to destPath
set accessRef to (open for access file destPath with write permission)
try
set eof accessRef to 0
write txt to accessRef as «class utf8»
end try
close access accessRef
end writeFile