Copy link to clipboard
Copied
Hi All,
Please suggest me why below code not working.
var myDoc = app.activeDocument;
app.findObjectPreferences=app.changeObjectPreferences=null;
app.findObjectPreferences.gapColor = myDoc.swatches[1] //paper
app.changeObjectPreferences.gapColor = myDoc.swatches[0] //None
myDoc.changeObject()
app.findObjectPreferences=app.changeObjectPreferences=null;
Thanks in advance,
Shonky
Copy link to clipboard
Copied
Hi Shonky,
I think Find & Changing the objects by using colors will not work in InDesign CS3 JS.
Try to do the process in some other way.
Regards,
Ramkumar .P
Copy link to clipboard
Copied
Thanks Ramkumar,
I am using Indesign CS4 and code not working in CS4 too.
I got the solution with below code:
var myDoc = app.activeDocument;
var mypageItems = myDoc.allPageItems
for (a=0; a<mypageItems.length; a++)
{
if (mypageItems.constructor.name == "Group")
{
continue;
}
mypageItems.gapColor = "None"
}
var mygroupItems = myDoc.groups
for (a=0; a<mygroupItems.length; a++)
{
for (b=0; b<mygroupItems.allPageItems.length; b++)
{
if (mygroupItems.allPageItems.constructor.name != "Group")
{
mygroupItems.allPageItems.gapColor = "None"
}
}
}
Its strange that find object not working. My previous code was correct i think.
Shonky
Find more inspiration, events, and resources on the new Adobe Community
Explore Now