Re: Font Testing - TOO slow.( Efficiency experts needed)
Re: Font Testing - TOO slow.( Efficiency experts needed)
- Subject: Re: Font Testing - TOO slow.( Efficiency experts needed)
- From: Hans Haesler <email@hidden>
- Date: Thu, 4 Jan 2001 15:01:50 +0100
On Thu, 4 Jan 2001, Xandra Lee wrote:
>
--The following routine tests that specific fonts are installed
>
before continuing a script. It works fine but... it's VERY slow if user
>
has many fonts installed & fonts are not found.
>
>
Additional QuerY: is there any way to get QXP to return just the font
>
names rather font records (as below?) (I have an OSAX that will do this
>
but prefer to use QXP for usabiltiy by others)
Hello Xandra,
additional reply first: you get the records then you loop through
them to list the names.
---
set fontList to {}
tell application "QuarkXPress 4.11"
set fList to font list
repeat with i from 1 to count of fList
set end of fontList to name of item i of fList
end repeat
end tell
fontList-->a list of the names
---
Now to your script:
---
property checkList : {"John", "Susan"} --non existent for testing reasons
--Halt script if neither font is found
set fontsCheck to my checkFonts(checkList)
on checkFonts(checkList)
set font1 to (item 1 of checkList)
set font2 to (item 2 of checkList)
tell application "QuarkXPress 4.11"
set fontList to font list
end tell
set n to count checkList
set m to count fontList
set nameFound to 0
repeat with i from 1 to n
set checkName to item i of checkList
repeat with j from 1 to m
set fontName to name of item j of fontList
if fontName = checkName then
set nameFound to nameFound + 1
exit repeat
end if
end repeat
end repeat
if nameFound is not n then
display dialog "This script uses
" & font1 & "
" & font2 & ".
Either install the fonts,
or change the script." buttons "Cancel" default button 1 with icon 2
beep
end if
---other stuff here
return nameFound
end checkFonts
---
This is about ten times faster.
Best regards,
Hans
---
Hans Haesler | email@hidden