🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #521

Re: auto font swap

#521
From: Fred_Goldman
Date: Thu, 12 Mar 2009 20:15
29 lines
2034 bytes
Here's a start. It will loop through the files in a folder. You can 
customize it to whatever fonts and font styles you need.

<PRE><BR>
myFolder = Folder (["~/Documents/InDesign Documents"])
myFiles = myFolder.getFiles()
for(var i = 0; i &lt; myFiles.length; i++){
&nbsp;&nbsp;var myDoc =&nbsp;&nbsp;app.open(myFiles[i])
&nbsp;&nbsp;for(var j= 1; myDoc.characterStyles.length&gt;j; j++){
&nbsp;&nbsp;&nbsp;&nbsp;if(myDoc.characterStyles[j].appliedFont == 
"Adobe Garamond Pro"  &amp;&amp; myDoc.characterStyles[j].fontStyle == 
"Regular"){
&nbsp;&nbsp;&nbsp;&nbsp;myDoc.characterStyles[j].appliedFont = "Adobe 
Whatever Pro"
&nbsp;&nbsp;&nbsp;&nbsp;myDoc.characterStyles[j].fontStyle = "Regular"
&nbsp;&nbsp;&nbsp;&nbsp;}else{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(myDoc.characterStyles[j].appliedFont 
== "Adobe Garamond Pro" &amp;&amp; myDoc.characterStyles[j].fontStyle == 
"Bold"){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myDoc.characterStyles[j].appliedFont 
= "Adobe Whatever Pro"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myDoc.characterStyles[j].fontStyle 
= "Bold"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;myDoc.close(SaveOptions.yes,myDoc.fullName)
}
</PRE>
Technical Details
Message-ID: <0950E42A8234766037B069CC6FC612E4@in.webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b82ebd.-1@webcrossing.la2eafNXanI> <59b82ebd.1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,4bc1edf4574cbc50
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Fred_Goldman@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: auto font swap
Message-ID: <0950E42A8234766037B069CC6FC612E4@in.webcrossing.la2eafNXanI>
Date: Thu, 12 Mar 2009 13:15:40 -0700
References: <59b82ebd.-1@webcrossing.la2eafNXanI> <59b82ebd.1@webcrossing.la2eafNXanI>
Lines: 33
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
X-Antivirus: avast! (VPS 090311-1, 03/11/2009), Outbound message
X-Antivirus-Status: Clean
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit