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