Hi,
I want a script to generate missing fonts request without opening the file. Is it possible? Please help me out today I am getting to much requirement for script.
Thanks
Pooja
Hi,
I want a script to generate missing fonts request without opening the file. Is it possible? Please help me out today I am getting to much requirement for script.
Thanks
Pooja
Hi All,
Please ignore my previous post. As I know that without opening the file it is not possible to get the information about content.
I want to generate a text file report having only the missing fonts name in the current document.
Can any one do it or please tell me how can I start.
tell application "QuarkXPress"
set myDoc to front document
tell myDoc
set f to font list
end tell
end tell
Now, how I will get a list of missing font and write in a file.
Thanks
Pooja
Hi Try this!
i don’t think you can actually script the font usage pane in quark so here i’ve had to cross reference
fonts that the application can see against fonts that the document knows it needs, and this is what i came up with!!
set l to {}
tell application "QuarkXPress"
set f to font list
repeat with i in f
set j to name of i
tell document 1
set t to font list
repeat with k in t
set m to name of k
if m is not equal to j then
copy m to end of l
end if
end repeat
end tell
end repeat
end tell
l --{"Helvetica"} i always get helvetica here as well as any others
I think you will always get helvetica because it is used by the default style sheet “Normal” I can’t find it now but think the trick was to look for font beginning with ““”
Hi
Apologies anyhow i think that script i posted was tosh!!
try this:
set l to {}
tell application "QuarkXPress"
set f to font list
repeat with i in f
copy name of i to end of l
end repeat
tell document 1
set t to font list
repeat with k in t
if name of k is not in l then
display dialog name of k
end if
end repeat
end tell
end tell
Hi pidge1,
It is working fine, but I want to generate a report of missing fonts. Is it possible to write in a file of all missing fonts.
Thanks
Pooja
Hi
I’m sure there’s guys on the forum who will do this neater and more efficient than me but see what you think!!
set p to {}
set l to {}
tell application "QuarkXPress"
set f to font list
repeat with i in f
copy name of i to end of l
end repeat
tell document 1
set t to font list
repeat with k in t
if name of k is not in l then
--display dialog name of k
copy name of k & return to end of p
end if
end repeat
set p to p as string
end tell
end tell
tell application "TextEdit"
activate
make new document
tell document 1
make at end new paragraph with data p
tell application "TextEdit"
set name of window 1 to "Missing Font List"
end tell
end tell
end tell
Hi,
It is working fine, but I want to save the report file at the location of the quark file. I was trying to do that but facing problem. See my code
set p to {}
set l to {}
tell application "QuarkXPress"
set f to font list
repeat with i in f
copy name of i to end of l
end repeat
tell document 1
set file_path to get the file path
set file_path to file_path as string
set t to font list
repeat with k in t
if name of k is not in l then
copy name of k & return to end of p
end if
end repeat
set p to p as string
end tell
end tell
tell application "TextEdit"
activate
make new document
tell document 1
make at end new paragraph with data p
tell application "TextEdit"
set name of window 1 to "Missing Font List"
end tell
save in file file_path & "missing_font_report.txt"
end tell
end tell
One more thing I would like to add, that it is taking to much time on a single file.
Thanks
Pooja
Hi
I’m not near a quark at the minute so can’t amend the script although i think i can answer one question!
this script isn’t really using a built in means to find the missing fonts other than checking a range of fonts that the application can access
and what the document your working on actually needs.
So i reckon if you have a lot of fonts loaded via suitcase etc. it will slow it down considerably.
i’ll look at your other problem when i get near a version of quark!!
Hi,
Sure and a lot of thanks.
Thanks
Pooja
Hi Pooja,
Try this, may be it will solve your purpose.
set p to {}
set L to {}
set pathname to (path to desktop folder as string) & "Report.txt"
set fileID to open for access file pathname with write permission
tell application "QuarkXPress"
set f to font list
repeat with i in f
copy name of i to end of L
end repeat
tell document 1
set file_path to get the file path
set file_path to file_path as string
set t to font list
repeat with k in t
if name of k is not in L then
copy name of k & return to end of p
end if
end repeat
set p to p as string
end tell
end tell
write p to fileID
Thanks
Hi Macrajeev
Thanks a lot. It is working fine, but is it possible to generate that report file at the file location. If ye then please help me. I want this report at the file location itself and having the file name_report.txt.
Thanks
Pooja
I was close but it turns out to be the font ID that is negative values when missing not the name. That said if I turn off my font auto activation this does work for me.
tell application "QuarkXPress"
activate
tell document 1
set Doc_Name to name
set Missing_Fonts to {}
set Font_List to font list
repeat with This_Font in Font_List
if ID of This_Font as number < 0 then
set end of Missing_Fonts to name of This_Font & return
end if
end repeat
set File_Path to file path as string
set File_Path to my File_Container(File_Path)
if Missing_Fonts is not {} then
set Missing_Fonts to Missing_Fonts as string
else
set Missing_Fonts to "No missing Fonts."
end if
my write_Report(Doc_Name, Missing_Fonts, File_Path)
end tell
end tell
on File_Container(File_Path)
tell application "Finder"
set File_Container to container of (File_Path as alias) as string
return File_Container
end tell
end File_Container
on write_Report(Doc_Name, Missing_Fonts, File_Path)
set The_Report to File_Path & Doc_Name & "“Missing Fonts.txt"
try
open for access file the The_Report with write permission
write Missing_Fonts to file the The_Report starting at eof
close access file the The_Report
on error
close access file the The_Report
end try
end write_Report
Made a small change was little point writing nothing to a report file where there are no missing fonts.
Hi All,
Can we do it same thing for InDesign CS2 Application. If possible please help me.
Thanks
Pooja
Hi Mark,
The above script is working fine. But when I copy this script in the script folder of Quark and try to run from the Menu available in Quark at that time is showing errors. Have you ever faced this type of problem. Even I saved as application and try o run but it showing errors.
The error is
But when I am running after opening source code. It is working fine. But I want to run this script through Quark Script Menu.
Regards,
Pooja
Using finder was a bit pointless when we have a file path as text you could just use TID’s to extract the segment you want. This appears OK from Quark menu
tell application "QuarkXPress"
activate
tell document 1
set Doc_Name to name
set Missing_Fonts to {}
set Font_List to font list
repeat with This_Font in Font_List
if ID of This_Font as number < 0 then
set end of Missing_Fonts to name of This_Font & return
end if
end repeat
set File_Path to file path as string
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set Parent_Path to (text items 1 thru -2 of File_Path as string) & ":"
set AppleScript's text item delimiters to ASTID
if Missing_Fonts is not {} then
set Missing_Fonts to Missing_Fonts as string
else
set Missing_Fonts to "No missing Fonts."
end if
my write_Report(Doc_Name, Missing_Fonts, Parent_Path)
end tell
end tell
on write_Report(Doc_Name, Missing_Fonts, Parent_Path)
set The_Report to Parent_Path & Doc_Name & "“Missing Fonts.txt"
try
open for access file the The_Report with write permission
write Missing_Fonts to file the The_Report starting at eof
close access file the The_Report
on error
close access file the The_Report
end try
end write_Report