Thread View: adobe.scripting.indesign
9 messages
9 total messages
Started by sandy9000
Wed, 11 Mar 2009 16:27
auto font swap
Author: sandy9000
Date: Wed, 11 Mar 2009 16:27
Date: Wed, 11 Mar 2009 16:27
4 lines
934 bytes
934 bytes
WinXP--IDCS3,5.0.4 Currently working on a template for multiple users and would prefer to keep only one template & script major font change. Unfortunately, I'm not a scripter, but I think this can be automated somehow. looking for a javascript to change all font family "Adobe Garamond Pro" to font family "Adobe Whatever Pro". User could then go in to script and modify with new font family name change. thanks sandy
Re: auto font swap
Author: Fred_Goldman
Date: Wed, 11 Mar 2009 16:35
Date: Wed, 11 Mar 2009 16:35
2 lines
817 bytes
817 bytes
So you want these changed in the style definition, of just in the text in the template?
Re: auto font swap
Author: sandy9000
Date: Thu, 12 Mar 2009 16:42
Date: Thu, 12 Mar 2009 16:42
4 lines
638 bytes
638 bytes
In the style definition would be the best. thanks sandy
Re: auto font swap
Author: 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>
Re: auto font swap
Author: Fred_Goldman
Date: Thu, 12 Mar 2009 20:17
Date: Thu, 12 Mar 2009 20:17
1 lines
677 bytes
677 bytes
Apparently it only works in the web view, not from a newsreader.
Re: auto font swap
Author: Fred_Goldman
Date: Thu, 12 Mar 2009 20:17
Date: Thu, 12 Mar 2009 20:17
23 lines
1493 bytes
1493 bytes
Hmm, why didn't Harbs' script poster work?
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)
}
Re: auto font swap
Author: sandy9000
Date: Thu, 12 Mar 2009 21:16
Date: Thu, 12 Mar 2009 21:16
3 lines
666 bytes
666 bytes
harbs poster ? s
Re: auto font swap
Author: Fred_Goldman
Date: Thu, 12 Mar 2009 21:29
Date: Thu, 12 Mar 2009 21:29
11 lines
1224 bytes
1224 bytes
Harbs made a script to make posting scripts on the forum easier. It shouldn't be difficult at all to customize the last script for your needs. 1) Just change character styles to paragraph styles if that's what you need. 2) Fill in the correct path in the first line. 3) Replace the font names in quotes to the ones you want to find and replace with.
Re: auto font swap
Author: sandy9000
Date: Fri, 13 Mar 2009 13:08
Date: Fri, 13 Mar 2009 13:08
10 lines
1052 bytes
1052 bytes
Thanks Fred --
If I want to add paragraph styles to script as well, is this the portion of script I would copy & paste, then modify?
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"
Users will be running script on an open InDesign file, would that change beginning (path portion) of script?
s
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads