Skip to main content
snegig
Known Participant
December 20, 2012
Answered

[JS] Kindly Check code

  • December 20, 2012
  • 2 replies
  • 1264 views

Hi,

I want change find all "Zapf Dingbats" character then all fonts outline

my code below:

var aa = app.findTextPreferences = app.changeTextPreferences = null;

app.findTextPreferences.appliedFont = "Zapf Dingbats"

app.findTextPreferences.fontStyle = "Regular"

app.findTextPreferences.pointSize = 9;

aa = app.selection[0].createOutlines(true);

thanks for advance:

This topic has been closed for replies.
Correct answer Vamitul

other err

Line: 6

Source: for (var i=0; i<found.length(); i++)


ok..

sorry, my computer was bussy processing something else, dind't have the chance to test/debug until now:

function main(){

app.findTextPreferences = app.changeTextPreferences = null;

app.findTextPreferences.appliedFont = "Zapf Dingbats";

app.findTextPreferences.fontStyle = "Regular";

app.findTextPreferences.pointSize = 9;

var found=app.activeDocument.findText(true);

for (var i=0; i<found.length; i++){

     try {

          found.createOutlines();

          } catch(e){};}

alert("All done!\nYou can go outside and play now!");

}app.doScript('main()',undefined,undefined,UndoModes.entireScript,'Outline all bullets');

2 replies

Vamitul
Legend
December 20, 2012

try this:

app.findTextPreferences = app.changeTextPreferences = null;

app.findTextPreferences.appliedFont = "Zapf Dingbats"

app.findTextPreferences.fontStyle = "Regular"

app.findTextPreferences.pointSize = 9;

var found=app.activeDocument.findText(true);

for (var i=0; i<found.length(); i++){

     try {

          found.creaateOutlines();

          } catch(e){};

alert("All done!\nYou can go outside and play now!");

edit: sorry jump; didn't see your reply

snegig
snegigAuthor
Known Participant
December 20, 2012

Sir script code err:

Offending Text: {

Vamitul
Legend
December 20, 2012

upps..

jus add a } after the catch(e){};

sorry

Jump_Over
Legend
December 20, 2012

Hi,

your code will try to create Outline from app.selection[0], which is not an effect of findText()

try this:

app.findTextPreferences = app.changeTextPreferences = null;

app.findTextPreferences.appliedFont = "Zapf Dingbats"

app.findTextPreferences.fontStyle = "Regular"

app.findTextPreferences.pointSize = 9;

myFound = app.findText();

step = myFound.length;

while step--

     myFound[step].createOutlines(true);

rgds