Replace a Font in InDesign

So, thanks to adobe, every document that contains a type 1 font now needs to be updated to an Open Type font. I have tried a few different options including using ChatGPT to write code for me, but no luck yet. The issue here is that I need to replace the old version of Univers Bold with a new version of Universe Bold. I see to have problems figuring out which font is which.

Is there a routine or something where I can say, if there is a font with a warning, use the find/replace font function to update the font.

I’ll post some code here of what i have so long as I didn’t delete it on Friday.
David

Here is my code…
On the line: if applied font of aCharacter is “Univers 65 Bold” then
I get an error that says it can’t get the font of that letter.

tell application “Adobe InDesign 2023”

– Check if any document is open

if (count of documents) is 0 then

display dialog “No document is open in Adobe InDesign 2023.” buttons {“OK”} default button 1 with icon 1

return

end if

– Get the active document

set doc to active document

– Get all text frames in the document

set allTextFrames to every text frame of doc

– Loop through each text frame

repeat with aFrame in allTextFrames

– Get the parent story of the text frame

set aStory to parent story of aFrame

– Get all characters in the story

set allCharacters to every character in aStory

– Loop through each character

repeat with aCharacter in allCharacters

– Check if the font of the character is “Univers 65 Bold”

if applied font of aCharacter is “Univers 65 Bold” then

– Set the font of the character to “ComicSans”

set applied font of aCharacter to “Univers 65 Bold”

end if

end repeat

end repeat

– Display completion message

display dialog “Font replacement complete.” buttons {“OK”} default button 1 with icon 1

end tell

use this line instead

if name of applied font of aCharacter is "Univers	65 Bold" then

note that after Univers you have to put a tab not a space

another idea is to use find/replace
put always a tab after family name not a space

tell application "Adobe InDesign 2023"
	
	set applied font of find text preferences to "Univers	65 Bold"
	set applied font of change text preferences to "Gotham	Bold"
	
	change text active document
	
end tell

While all of that might be true… I am running into a problem where

if applied font of aCharacter is “Univers 65 Bold” then

can’t determine what the font of the first character is.

I don’t need to be looking at the characters though, just the words. So I can modify that, but I think I’ll still run into the problem of not seeing the applied font.

Hmmm…
David

as I said before you have to change

if applied font of aCharacter is “Univers 65 Bold” then

with

if name of applied font of aCharacter is “Univers 65 Bold” then

“Univers 65 Bold” is the name of the applied font

The solution is here:

Search is a powerful tool. Much more than chatbots.

1 Like

Well… this is, by far, the easiest way to achieve what I want to do.

tell application “Adobe InDesign 2023”
activate
set applied font of find text preferences to “Aachen” & tab & “Bold”
set applied font of change text preferences to “Alex Brush” & tab & “Regular”
change text active document
end tell

HOWEVER, there is something weird going on. As stated originally, InDesign is telling me that I have Type 1 fonts no longer supported. This particular one is Univers 65 Bold. I can’t seem to get this Type 1 font to change. If I go in and manually change it to some other font, then back to the OTF version of Univers 65 Bold, THEN the script works on the font to change it to something else. But not on the Type 1 font.

Any thoughts??

As for the chatbot writing code, I was more curious to see how accurate the code would be. I did search on here first but apparently wasn’t searching for the proper text. :wink:

David