Works in ExtendScript and not in Script Panel [JS, CS3]


i've adapted findchangebylist script work particular page.

 

the trouble couple of text boxes need removed entirely.

 

so i've included lines:-

 

var mydoc = app.activedocument;

var mypageitems = mydoc.allpageitems;

for(var i=mypageitems.length-1;i>=0;i--)

{

    if(mypageitems[i].constructor.name.tostring()=="textframe")

    {

if (mypageitems[i].contents == "win £50"||mypageitems[i].contents == "win £100") {

mypageitems[i].select();

mypageitems[i].remove();

}

    }

}

 

... script gets down doing changes prescribed list

 

myobject = app.documents.item(0);

myfindchangebylist(myobject);

 

when run script in extendscript boxes vanish intended.

 

but when run indesign scripts panel, text frames stay , contents changed along contents of other text frames.

 

i've alt clicked script in scripts panel make sure i've got right script. it's 1 of head-scratchy-am-i-going-dafter affairs.

after testing box deletion part in scripts panel , checking wasn't culprit, saved box deleter script , specialised findchangefromlist script in indesign scripts folder (so don't appear in scripts panel) , wrote applescript 2 "do scripts". when run scripts panel script job. inelegant, know, ours not reason why, ours working.



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO