• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Some fonts is not recognized by InDesign in Applescript

Explorer ,
Jul 12, 2018 Jul 12, 2018

Copy link to clipboard

Copied

Hello

I have a strange problem when trying to make Applescript create Paragraph styles in InDesign.

In the example below, the first "make new paragraph style" (Copperplate regular) works fine but the second (Copperplate light) fails with the error message: "The requested font style is not available." number 15874"...

I have both fonts available in InDesign, I geet the same problem also with other font families.

Anyone who has an idea of why this happens?

The script:

tell application "Adobe InDesign CC 2014"

  

   tell active document

       make new paragraph style with properties {name:"Copperplate Regular", applied font:"Copperplate    Regular", font style:"Regular"}

       make new paragraph style with properties {name:"Copperplate Light", applied font:"Copperplate    Light", font style:"Light"}

   end tell

end tell

Appreciate any help...

Cheers

Johan

TOPICS
Scripting

Views

932

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jul 13, 2018 Jul 13, 2018

If it's any consolation, I have run into the same problem in the past. So I decided to see if the problem still exists. Today I simply can't find a font that will fail.

My scripts check for the status of the font, if installed then I create the style. Be careful to name the font correctly using a tab between the font name and its style, as in:

set x to status of font ("Bradley Hand" & "\t" & "Bold")

I still can't figure out why I remember "Brush Script MT" & "\t" & "Italic" failed, and now I can't

...

Votes

Translate

Translate
Community Expert ,
Jul 13, 2018 Jul 13, 2018

Copy link to clipboard

Copied

Hi Johan,

format some text with Copperplate Light and check by scripting what the applied font's properties are.

That should you give some hints to solve your problem.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2018 Jul 13, 2018

Copy link to clipboard

Copied

Thank you Uwe.

Actually, in the full script I get the full properties from the first word of each text frame and use those properties to create the Paragraph styles and still get this error for some fonts, even within a font family some work and some don't...

I did this short script just to keep it simple here.

Regards

Johan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 13, 2018 Jul 13, 2018

Copy link to clipboard

Copied

If it's any consolation, I have run into the same problem in the past. So I decided to see if the problem still exists. Today I simply can't find a font that will fail.

My scripts check for the status of the font, if installed then I create the style. Be careful to name the font correctly using a tab between the font name and its style, as in:

set x to status of font ("Bradley Hand" & "\t" & "Bold")

I still can't figure out why I remember "Brush Script MT" & "\t" & "Italic" failed, and now I can't make it fail.

Hope this helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2018 Jul 13, 2018

Copy link to clipboard

Copied

Thank you Hopkins.

I will try out your check!

Could it be the InDesign version? What version were you on when you had the problem?

Did you change it since?

We are still on CC 2014...

Cheers

Johan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2018 Jul 13, 2018

Copy link to clipboard

Copied

Seems like the check actually helped, with some modification to my originals script.

This worked (With the Futuras I originally had the problem with)

tell application "Adobe InDesign CC 2014"

  set x to status of font ("Futura Std" & " " & "Bold")

  set y to status of font ("Futura Std" & " " & "Heavy")

 

  tell active document

  make new paragraph style with properties {name:"Futura Bold", applied font:"Futura Std" & " " & "Bold"}

  make new paragraph style with properties {name:"Futura Heavy", applied font:"Futura Std" & " " & "Heavy"}

  end tell

end tell

Now I only have to find a way to check all fonts used in the document...

Thank you again Hopkins!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 13, 2018 Jul 13, 2018

Copy link to clipboard

Copied

I believe this has been an occasional problem in just about every InDesign version. Latest hiccup was just a few weeks ago, version 2018. Thought at that time the problem was that I had not used the font--ever--but once used, it came up "installed". BTW: I just use the font name (the tabbed version) to assign it to the style:

tell application "Adobe InDesign CC 2018"

set fString to "Minion Pro" & " " & "Regular" --space is a tab

if status of font fString is installed then

tell document 1

make paragraph style with properties {name:"TestStyle", applied font:font fString}

end tell

end if

end tell

(Maybe your way is better???)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 16, 2018 Jul 16, 2018

Copy link to clipboard

Copied

I do not think the font style is necessary, I used it mainly because it is part of the properties I use in my big script.

I did this small script to check all fonts in the document:

tell application "Adobe InDesign CC 2014"

  tell active document

  set TheFontCount to count of every font

  repeat with i from 1 to TheFontCount

  set x to status of font i

  end repeat

  end tell

end tell

Sadly it doesn't help in my main script, I still get the same error even though the check says that all fonts are installed 😕

Big thanks for your help Hopkins! Marked your answer as correct answer even though it didn't help me solve the problem completely...

Cheers

Johan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 16, 2018 Jul 16, 2018

Copy link to clipboard

Copied

LATEST

Hi again.

I managed to do a workaround by (on error) saving the value of the original applied font, setting the font to Arial, make the new paragraph style with the properties of the Arial character and then set properties on the new style to the original applied font.

Like this:

  try

  make new paragraph style with properties ThePstyleProps & {name:NewName}

on error

  try

set DaFont to the applied font of character 2 of TheTextFrame

set properties of character 2 of TheTextFrame to {applied font:"Arial Regular"} ---------------------------------------

  set ThePstyleProps to properties of character 2 of text frame i

  make new paragraph style with properties ThePstyleProps & {name:NewName}

  set properties of paragraph style NewName to {applied font:DaFont}

Not the most beautiful workaround, but now it works

Again, thank you for the input!

Johan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines