Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 86170

Re: Can you help me with this script

$
0
0

Try this,

 

var d = app.activeDocument; 
k=1;
function myFindObjStyle(a) { 
var x, i; 
for(i = 0; i < a.length; ++i) { 
if(i == a.length - 1) { 
x = (x ? x : d).objectStyles.item(a[i]); 
if(!x || !x.isValid) return null; 
} else { 
x = (x ? x : d).objectStyleGroups.itemByName(a[i]); 
if(!x || !x.isValid) return null; 
} 
} 
return x.isValid ? x : null; 
} 
function paragraphByNesneStilWp(stil) { 
var tests = [], i, j, it, p, finded; 
for(i = 0; i < d.pages.length; ++i) { 
p = d.pages.item(i); 
if(p && p.isValid) { 
pi = p.pageItems; 
finded = false; 
for(j = 0; j < pi.length; ++j) { 
it = pi[j]; 
if(it && it.appliedObjectStyle == stil) { 
finded = true; 
tests.push({pr: it, sn: i}); 
break; 
} 
} 
if(!finded) { 
pi = p.masterPageItems; 
for(j = 0; j < pi.length; ++j) { 
it = pi[j]; 
if(it && it.appliedObjectStyle == stil) { 
tests.push({pr: it.override(p), sn: i}); 
//pi[j].insertionPoints[0].contents="sajeev";
break; 
} 
} 

pi = p.pageItems; 
for(j = 0; j < pi.length; ++j) { 
it = pi[j]; 
if(it && it.appliedObjectStyle == stil) {     pi[j].select();    if(i % 2 == 0)    {        pi[j].insertionPoints[0].contents="Example " + (k);    }    else    {        pi[j].insertionPoints[0].contents="Example " + (k);        k++;    }
break; 
} 
} 
} 
} 
} 
return tests; 
} 
var FobjectStyle, objectss; 
FobjectStyle = myFindObjStyle(["AA1"]); 
if(!FobjectStyle) {         alert("no style"); 
} 
objectss = paragraphByNesneStilWp(FobjectStyle);  

 

Vandy


Viewing all articles
Browse latest Browse all 86170

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>