• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing fonts (and faces) in InDesign paragraph & character styles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing fonts (and faces) in InDesign paragraph & character styles


  • Subject: Re: Changing fonts (and faces) in InDesign paragraph & character styles
  • From: "Houston, Brad" <email@hidden>
  • Date: Wed, 01 May 2013 17:54:00 -0400
  • Acceptlanguage: en-US
  • Thread-topic: Changing fonts (and faces) in InDesign paragraph & character styles

Title: Re: Changing fonts (and faces) in InDesign paragraph & character styles
Hi JF,

Threw this together quickly, and I don’t have the font’s you are dealing with, or InDesign 6, but seems to work on a quick test. Exploiting the pattern of style name changes, since I’m lazy. Runs through a folder, looking for InDesign files, penetrating down folder levels if needed. You’ll need to change the “IDd2” to whatever the file type is for InDesign 6, or get rid of that discriminator altogether.

Brad

choose folder
set x to the result
my foldsearch(x)

on foldsearch(x)
    
tell application "Finder"
        
set d to every item of x
       
repeat with x in d
           
if kind of x = "folder" then
               my foldsearch(x)
            
else
               if file type of x = "IDd2" then
                   my change_fonts(x)
                
end if
           end if
       end repeat
   end tell
end
foldsearch

beep 3


on change_fonts(x)
    
tell application "Adobe InDesign CS5.5"
        
tell document 1
            
open x
           
set RR to every paragraph style
           repeat with kk in RR
               
tell kk
                   
if index of kk > 2 then
                       if applied font as string = " Helvetica Neue LT" then
                           set applied font of kk to " Helvetica Neue LT Std"
                            
set jj to font style as string
                           set font style to text 4 thru length of jj
                       
end if
                   end if
               end tell
           end repeat
           
            
set RR to every character style
           repeat with kk in RR
               
tell kk
                   
if index of kk > 2 then
                       if applied font as string = " Helvetica Neue LT" then
                           set applied font of kk to "Helvetica Neue LT Std"
                            
set jj to font style as string
                           set font style to text 4 thru length of jj
                       
end if
                   end if
               end tell
           end repeat
           
            
close saving yes
       
end tell
       
    
end tell
end
change_fonts




On 5/1/13 1:00 PM, "JF" <email@hidden> wrote:

Hi Chris, thank you for your reply.

I have made some progress in my script, but I am not there yet.
I can address a single style, but have difficulties in telling
all the styles to loop and change IF the font name is "Helvetica
Neue LT". There are some styles which do not have this font and
I'd end up in even more of a mess if I change a style to the
wrong font and its attributes. I think this version managed to
avoid changing any character style which was not using Helvetica
Neue LT:

___________________________________
tell application "Adobe InDesign CS6"
     tell character style "45 Light" of active document
         --      tell selected item of active document
         if applied font is "Helvetica Neue LT" then
             set applied font to "Helvetica Neue LT Std"
             if font style is "LT 65 Medium" then
                 set font style to "65 Medium"
             end if
             if font style is "LT 45 Light" then
                 set font style to "45 Light"
             end if
             if font style is "LT 46 Light Italic" then
                 set font style to "46 Light Italic"
             end if
             if font style is "LT 75 Bold" then
                 set font style to "75 Bold"
             end if
             if font style is "LT 55 Roman" then
                 set font style to "55 Roman"
             end if
         end if
         set kerning method to "Metrics"
     end tell
end tell
_______________________________
I'll try to adapt your loop to work in InDesign, but I am not
sure how I can call all the character styles one after the other.

The alternative (which I often use) is the semi manual approach:
select the style and tell it to change, but you can see in the
script above my attempt did not work (it is misplaced at the moment).


On 1/5/13 at 20:25, Chris.Paveglio@<hidden> (Chris Paveglio) wrote:

>Hi JF,
>It appears that you are probably pretty new to Applescript or programming.
>You are going to have to work on some basics first.
>
>You can loop through a list of objects like some styles like:
>
>tell application "Adobe InDesign CS5"
>tell document 1
>set docCharStyles to every character style
>
>repeat with aStyle in docCharStyles
>tell aStyle
>--<do some actions here>
>end tell
>end repeat
>end tell
>end tell
>
>As far as changing something from one thing to another, you might have to
>use a lot of lists or IF/ELSE statements to switch them. If you have a lot
>of fonts that change from one style to another, it will be a big list of
>IFs. There may be no way around having some kind of giant list of If this
>font style then some other font style
>
>If font style is "65 Medium" then
>set font style to "75 Medium"
>Else if font style is "85 Black" then
>set font style to "86 Black Italic"
>Else if font style is "77 Bold Condensed" then
>set font..... Etc etc
>
>Or
>
>If (font style is "65 Medium") and (applied font is "Helvetica") then
>--do things
>
>--
>Chris
>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. The McGraw-Hill Companies, Inc. reserves the right, subject to applicable local law, to monitor, review and process the content of any electronic message or information sent to or from McGraw-Hill e-mail addresses without informing the sender or recipient of the message. By sending electronic message or information to McGraw-Hill e-mail addresses you, as the sender, are consenting to McGraw-Hill processing any of your personal data therein.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Changing fonts (and faces) in InDesign paragraph & character styles (From: JF <email@hidden>)

  • Prev by Date: Re: uneditable
  • Next by Date: Re: uneditable
  • Previous by thread: Re: Changing fonts (and faces) in InDesign paragraph & character styles
  • Next by thread: Re: Changing fonts (and faces) in InDesign paragraph & character styles
  • Index(es):
    • Date
    • Thread