Article View: adobe.scripting.indesign
Article #521Re: auto font swap
From: Fred_Goldman
Date: Thu, 12 Mar 2009 20:15
Date: Thu, 12 Mar 2009 20:15
29 lines
2034 bytes
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 < myFiles.length; i++){
var myDoc = app.open(myFiles[i])
for(var j= 1; myDoc.characterStyles.length>j; j++){
if(myDoc.characterStyles[j].appliedFont ==
"Adobe Garamond Pro" && myDoc.characterStyles[j].fontStyle ==
"Regular"){
myDoc.characterStyles[j].appliedFont = "Adobe
Whatever Pro"
myDoc.characterStyles[j].fontStyle = "Regular"
}else{
if(myDoc.characterStyles[j].appliedFont
== "Adobe Garamond Pro" && myDoc.characterStyles[j].fontStyle ==
"Bold"){
myDoc.characterStyles[j].appliedFont
= "Adobe Whatever Pro"
myDoc.characterStyles[j].fontStyle
= "Bold"
}
}
}
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!webcrossingReferences:
<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