Copy link to clipboard
Copied
Hi Eveyone,
I am trying to find placed inline rules and apply object styles through javascript. Because we need some baseline shift to those rules. I getting some error while find the rules. FInd the syntax below,
//---------------------
app.findObjectPreferences=app.changeObjectPreferences=null;
app.findChangeObjectOptions.properties =
{
objectType: ObjectTypes.unassignedFramesType
};
app.findObjectPreferences.strokeWeight=1;
app.changeObjectPreferences.appliedObjectStyles=app.activeDocument.objectStyles.item("WOL");
app.activeDocument.item(0).changeObject();
//-----------------------
Can anyone look into this help for me. Thanks in advance.
Regards
Thiyagu
Copy link to clipboard
Copied
The last line must be rather:
app.activeDocument.changeObject();
@+
Marc
Copy link to clipboard
Copied
... I getting some error ...
I bet the line number in that error pointed directly at the syntax error Marc mentions.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The problem is almost certainly caused by the "s" on the end of appliedObjectStyle. The error message is far from helpful, but it's often the case that an inexplicable error message is the result of a simple typo.
Dave
Copy link to clipboard
Copied
My script is also stopping on
myInDesign.FindObjectPreferences.AppliedObjectStyle = myDoc.ObjectStyles.Item("MainPic")
(also tried myInDesign.FindObjectPreference.AppliedObjectStyle = myDoc.ObjectStyles.Item("MainPic"))
with the following message;
Any ideas?
Many thanks
Paul
Copy link to clipboard
Copied
Hi Dave,
I have tried the script after removing "s" in it. Now i am getting error like "object doesn't support the property or method 'appliedObjectStyle'". Please look into this and help me out. Herewith i attached the 'error' dialog snapshot.
When i tried this in loop its working fine. Find the script below.
//------------------------
app.findObjectPreferences=app.changeObjectPreferences=null;
app.findChangeObjectOptions.properties =
{
objectType: ObjectTypes.unassignedFramesType
};
app.findObjectPreferences.strokeWeight=1;
myFindObj=app.findObject(true);
for(i=0;i<myFindObj.length;i++){
myFindObj.appliedObjectStyle=app.activeDocument.objectStyles.item("WOL");
}
alert ("DONE!");
//-------------------------
Regards
Thiyagu
Copy link to clipboard
Copied
Hi Dave any help for my queries. Thanks in advance.
Thiyagu
Copy link to clipboard
Copied
Oh wow! This is the first time I've ever looked at findObject. I was wrong. That "s" belongs there.
To be honest, I wouldn't go about it this way. I'd use findText and look for "^a", then I'd check the first page item of the found text to see if it was one I was interested in.
Dave
Copy link to clipboard
Copied
Hi Dave!
Thanks for looking into this. I thought Find Object is same like, Find Text, Find Grep & Find Glyph. So i tried it in the same way. Because the search is very specific. If i go with find text ^a, it will find all frames which are placed as inline. Then we have to check the frame properties. So far i have not yet tried it to find and change object's characteristics.
I think assigning object style in the change object preferences only giving trouble. If you got any solution kindly let me know it.
Thanks & Regards
Thiyagu