I need to go through hundreds of InDesign CS5.5 documents and identify which documents have used Type 1 fonts. Ideally, I’d like to generate a report that includes the name of the document (including the doc’s location and enclosing folder) and a list of the Type 1 fonts used in that document.
I am hoping that AppleScript might provide a way to accomplish this. Any advice on this project will be appreciated. Thanks!
try this. It asks for a folder, open all files in Indesign and writes the results in a plain text file on desktop
named [folder name].txt
set sourceFolder to choose folder
tell application "Finder"
set fileList to files of sourceFolder whose name extension is "indd"
set sourceFolderName to name of sourceFolder
end tell
set theFile to (path to desktop as text) & sourceFolderName & ".txt"
set {ASTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
try
set datastream to open for access file theFile with write permission
write (sourceFolder as text) & return & return to datastream
repeat with aFile in fileList
set currentFile to aFile as text
tell application "Adobe InDesign CS3"
set doc to open file currentFile
set docName to name of doc
try
set type1Fonts to (name of fonts of doc whose font type is type 1)
if (count type1Fonts) > 0 then
write "Document : " & docName & return to datastream
write (type1Fonts as text) & return & return to datastream
end if
end try
close doc saving no
end tell
end repeat
close access datastream
on error e
display dialog "An error occurred: " & e
try
close access file theFile
end try
end try
set AppleScript's text item delimiters to ASTID
Stefan, once again you have stepped in with code that has been very helpful. I have added a few tweaks, mostly to help create a .csv output file that I can bring into Excel. But the script now seems to be working sporadically at best. My specific error is at this point:
get name of every font of document id 1 whose font type = type 1
→ error number -1708
display dialog “Adobe InDesign CS5.5 got an error: Can’t get name of every font of document id 1 whose font type = type 1. -1728”
I will continue to troubleshoot and see where I might have messed up your code, but it is odd in that it seems to occasionally work as expected, only to slip back into generating the above error.
Stefan, thanks again for your expertise on this one. Thanks to you, I was able to accurately report on the use of Type 1 fonts at our company (we are trying to use OpenType whenever and wherever possible).