How can I tell if a file is a Font?

G’day

I’ve got a problem with people sending inDesign files that we’re trying to open and print automatically.

Problem is, they sometimes include fonts in the whole package of folders that need to be installed before the diagram is opened.

How can I tell which files in the folder are fonts, and then script to install them please? Often they don’t have suffixes.

Regards

Santa

Model: G5 1.8 GHz
AppleScript: 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Santa,

try this

set inputFolder to (choose folder with prompt "Select folder" without invisibles)
tell application "Finder"
	set theFonts to (get files of entire contents of inputFolder whose kind contains "font")
	-- move theFonts to (path to fonts from user domain) -- moves found files to ~/Library/Fonts
end tell

It’s ok, solved it, thanks.


tell application "Finder"
	set temp to folder "Fonts"
	my getItemNames(temp)
	tell application "Font Book"
		quit
	end tell
end tell

on getItemNames(aFolder)
	tell application "Finder"
		set theFolderItems to (get items of aFolder)
	end tell
	repeat with anItem in theFolderItems
		tell application "Finder"
			if kind of anItem is not "folder" then
				set continueProc to false
				if (kind of anItem as string) contains "font" then
					open anItem
					delay 3
					tell application "System Events" to tell process "Font Book"
						click button "Install Font" of group 1 of window 1
					end tell
				end if
			else
				set continueProc to true
			end if
		end tell
		if continueProc is true then
			getItemNames(anItem)
		end if
	end repeat
end getItemNames

Thanks Stefan, yours is a much more eloquent way of doing it.

Santa

:slight_smile:
btw: Font Book is fully scriptable (it has an add command)