Copy link to clipboard
Copied
Hi All,
I am trying to change the Mahtamatical Pi 1 Multiplication sign (×) to Symbol font. So i have used the below script. but its not workig for me. please help me on this..
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedFont = "Mathematical Pi";
app.findTextPreferences.fontStyle = "1";
app.findTextPreferences.findWhat = "3";
app.changeTextPreferences.changeTo = "<00D7>";
var myResults = app.activeDocument.findText();
for (i = 0; i <= myResults.length - 1; i++)
{
myResults.appliedCharacterStyle = "symbols";
app.changeText(undefined, false, false, undefined,{},{});
}
Also i am trying to change the entire greek characters (alpha, beta, gamma, etc...) font from mathamatical pi one to symbol font. Is it possible to execute with in the loop??
Thanks
M. Karthik
Copy link to clipboard
Copied
You're mixing pre-CS3- and CS3+ styles. You don't need a loop to change the multiplication sign:
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedFont = "Mathematical Pi";
app.findTextPreferences.fontStyle = "1";
app.findTextPreferences.findWhat = "3";
app.changeTextPreferences.changeTo = "<00D7>";
app.changeTextPreferences.appliedCharacterStyle = "symbols";
app.activeDocument.findText();
As to changing all Greek characters, how easy that is depends on whether the Greek characters are mapped to the same font positions in the Math Pi and the symbol fonts. For instance, are Math Pi 'a' and Symbol 'a' both alpha?
Peter
Copy link to clipboard
Copied
Yes, Math Pi 'a' and Symbol 'a' both for alpha characters. But some characters has been changed. Just now i have created the below script ...
var My_Math_pi_alphabets = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","y","z");
var My_Symbol_alphabets = new Array("a","b","y","d","e","f","g","h","i","x","k","l","m","n","o","p","r","s","t","q","w","j","c","u","z");
for (i=0; i<My_Math_pi_alphabets.length; i++)
{
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedFont = "MathPiOne";
app.findTextPreferences.fontStyle = "Italic";
app.findTextPreferences.findWhat = My_Math_pi_alphabets;
app.changeTextPreferences.changeTo = My_Symbol_alphabets;
app.changeTextPreferences.appliedCharacterStyle = "symbols";
app.activeDocument.changeText();
}
Copy link to clipboard
Copied
In that case you have to do it the way you showed. But there's no need to set the font and the styles at every iteration, you need to do that just once:
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedFont = "MathPiOne";
app.findTextPreferences.fontStyle = "Italic";
app.changeTextPreferences.appliedCharacterStyle = "symbols";
for (i=0; i<My_Math_pi_alphabets.length; i++)
{
app.findTextPreferences.findWhat = My_Math_pi_alphabets;
app.changeTextPreferences.changeTo = My_Symbol_alphabets;
app.activeDocument.changeText();
}
Same result, but more efficient.
Peter
Find more inspiration, events, and resources on the new Adobe Community
Explore Now