The AppleScript code below (that returns a list of active fonts) works fine when run from Script Editor, but returns an error when run from within FileMaker. Any ideas how to fix so it can run when called within FileMaker?
Error Message: Can't make {availableFontFamilies of sharedFontManager of NSFontManager} into type string.
use framework "AppKit"
tell application "FileMaker Pro"
set fontFamilyNames to (current application's NSFontManager's sharedFontManager's availableFontFamilies) as list
set AppleScript's text item delimiters to return
set fontList to every item of fontFamilyNames as string
set data cell "scriptResult" of table "globals" to fontList
end tell
Supporting Details:
There is no need for any tell
command. When you run AppleScript from within FileMaker, the entire script is wrapped in a default tell application "FileMaker Pro"
block. You need to use tell
only when you want some commands to be executed by another application.
You should be able to do simply:
use framework "AppKit"
set fontFamilyNames to (current application's NSFontManager's sharedFontManager's availableFontFamilies) as list
set AppleScript's text item delimiters to return
set fontList to every item of fontFamilyNames as string
set cell "YourField" of table "YourTable" to fontList
(This is assuming that's the best way to get a list of available fonts; I haven't looked into that and I see there are alternatives.)