Skip to main content
Mcrazy
Participant
April 11, 2017
Answered

Find and replace object and font

  • April 11, 2017
  • 1 reply
  • 1418 views

i was trying to flip objects with stroke value other than zero, so i tried the below code after selecting the object

app.selection[0].absoluteFlip = Flip.HORIZONTAL;

and it worked but i want to automate this process so i tried the below code

app.findObjectPreferences = NothingEnum.nothing;

app.changeObjectPreferences = NothingEnum.nothing;

app.findObjectPreferences.strokeWeight != "0";

app.changeObjectPreferences.absoluteFlip = Flip.HORIZONTAL;

app.changeObjectPreferences.flip;

myDocument.changeObject();

but it gives error because "absoluteFlip" cant be used with "changeObjectPreferences " so what should i do

and also i dont know how to adjust settings for find object like "includeFootnotes" and "includeHiddenLayers"

the same way i do with find/replace text and grep

also i was trying to automate find and replace fonts using grep but i faced a problem with empty text frames and empty tables

i solved the text frames problem but i dont know how to do it in tables can any body help me in these two problems

This topic has been closed for replies.
Correct answer tpk1982

Hi..

You cant use != condition directly in find preference..

use this code..

app.findObjectPreferences=app.changeObjectPreferences=null;

app.findObjectPreferences.strokeWeight=1;

myFindObj=app.findObject(true);

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

    if(myFindObj.strokeWeight!=0){

        myFindObj.flipItem(Flip.HORIZONTAL, AnchorPoint.CENTER_ANCHOR);

}

}

1 reply

tpk1982
tpk1982Correct answer
Legend
April 12, 2017

Hi..

You cant use != condition directly in find preference..

use this code..

app.findObjectPreferences=app.changeObjectPreferences=null;

app.findObjectPreferences.strokeWeight=1;

myFindObj=app.findObject(true);

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

    if(myFindObj.strokeWeight!=0){

        myFindObj.flipItem(Flip.HORIZONTAL, AnchorPoint.CENTER_ANCHOR);

}

}

tpk1982
Legend
April 12, 2017

Please remove the line 2 in the above script (app.findObjectPreferences.strokeWeight=1).. I forget to remove that.. so it will work for all cases