changing applied font via if (
Hello all,
I'm been experimenting with a few scripts that employ large substantial changes to an indesign template when it needs to be handed over to another language.
Some languages also require a font change and that seems to be the aspect of the script that is giving me trouble.
here is a shortened version of the script (without all the other things that need to change(kerning, language etc etc))
function arabic()
{
var myStyles = app.activeDocument.allParagraphStyles;
for (oneStyle=1;oneStyle<myStyles.length;oneStyle++)
{
if (myStyles[oneStyle].appliedFont= "Adobe Garamond Pro"){
myStyles[oneStyle].appliedFont= "Yakout Linotype";
myStyles[oneStyle].fontStyle= "Light";}
if (myStyles[oneStyle].appliedFont= "Myriad Pro"){
myStyles[oneStyle].appliedFont= "Yakout Linotype";
myStyles[oneStyle].fontStyle= "Bold";}
}
arabic();
Now, I'm assuming this is a syntax error of some kind because everything is being changed to Yakout Linotype Bold when in fact (clearly) it is meant to be conditional on whether or not the font currently applied to the paragraph style is Garamond or Myriad Pro.
Whats interesting is when I undo through the steps of the script, it does seem to identify each font (garamond and myriad) seperately, but then seems to eventually come to the conclusion that it should apply bold to everything.
It seems to me that I'm quite close, but I also seem to be at the end of my knowledge. If anyone could help I'd be much obliged. Thank you!
