Skip to main content
Participating Frequently
November 18, 2008
Question

Replace some document fonts Indesign CS3

  • November 18, 2008
  • 9 replies
  • 1576 views
To make long story short, we receive pages generated by a PBS system where they are having some issues programing the correct fonts for our folios.
I was hoping to use an applescript that would replace the wrong font with the right one. The following is as far as i can get, but this just changes it in the find window of Indesign and we have to click "change all"

tell application "Adobe InDesign CS3"

set properties of find text preferences to {applied font:"Myriad Pro", font style:"Regular"}

set properties of change text preferences to {applied font:"Frutiger", font style:"57 Condensed"}

{include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}
end tell
This topic has been closed for replies.

9 replies

Participating Frequently
November 26, 2008
Thanks Eric, the script runs perfect now.
November 26, 2008
I think those are in the scripting preferences. Put them on either side of open thisDoc.
set user interaction level of script preferences to never interact

open thisDoc
set user interaction level of script preferences to interact with all
Participating Frequently
November 26, 2008
Thanks loic_aigon,
But after adding set user interaction level i get a message as follows:

((Can't set «class UIA« of application "Adobe InDesign CS#" to «constant elnteNvr«))
Any ideas???
Loic.Aigon
Legend
November 26, 2008
Use this for avoiding being prompted
set user interaction level to never interact

Use this one to reset the interaction
set user interaction level to interact with all
Participating Frequently
November 25, 2008
Thanks Eric, I cleaned it up and it works great on some pages. The problem is if page has a dialog box open up (Example links have been modified and is waiting for FIX button or FIX Links automatically button to be clicked. This cases script to fail.

Is there a way for script to ignore or cancel dialog box so it can continue. Then we would deal with those other issues later.
November 20, 2008
This is a skeleton for a droplet version of Shane's script. I haven't actually run it, but I think it should work...

on open fileList

if length of fileList < 1 then

display dialog "Must drop InDesign files on this app to use it." buttons "Cancel" default button 1

end if

tell application "Adobe InDesign CS3"

clear existing settings

set properties to {find text preferences:nothing, change text preferences:nothing}

set options

set properties of find change text options to {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}

set up new settings

set properties of find text preferences to {applied font:"Myriad Pro", font style:"Regular"}

set properties of change text preferences to {applied font:"Frutiger", font style:"57 Condensed"}

repeat with thisDoc in fileList

open thisDoc

tell active document

change text -- I think this will work on the active document

close with save

end tell

end repeat

end tell

end open

EDIT: I have no idea why line breaks stopped working in this post... sorry it looks ugly. Best I could do.
Participating Frequently
November 20, 2008
is it possible to turn this into some type of a droplet?? so that i can drag and drop files on to it?
Participating Frequently
November 19, 2008
Thanks very much, that works great!
Inspiring
November 18, 2008
You were almost there:<br /><br />tell application "Adobe InDesign CS3"<br /> -- clear existing settings<br /> set properties to {find text preferences:nothing, change text<br />preferences:nothing}<br />-- set options<br /> set properties of find change text options to {include footnotes:true,<br />include master pages:true, include hidden layers:true, whole word:false}<br />-- set up new settings<br /> set properties of find text preferences to {applied font:"Myriad Pro",<br />font style:"Regular"}<br /> set properties of change text preferences to {applied font:"Frutiger",<br />font style:"57 Condensed"}<br />-- make the change<br /> change text document 1<br />end tell<br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>