• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

find inline objects and apply object styles...

Explorer ,
Sep 11, 2009 Sep 11, 2009

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

TOPICS
Scripting

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 12, 2009 Sep 12, 2009

Copy link to clipboard

Copied

The last line must be rather:

app.activeDocument.changeObject();

@+

Marc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2009 Sep 12, 2009

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 14, 2009 Sep 14, 2009

Copy link to clipboard

Copied

Hi Marc & Jonware,


Thanks for looking into this. As i have changed the last line of the script but the error is in the object style defining line. Please refer the attached snapshot.

Thanks in advance

Thiyagu

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 15, 2009 Sep 15, 2009

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 17, 2009 Sep 17, 2009

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;

Public member 'AppliedObjectStyle' on type 'FindObjectPreference' not found.

Any ideas?

Many thanks

Paul

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 17, 2009 Sep 17, 2009

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 22, 2009 Sep 22, 2009

Copy link to clipboard

Copied

Hi Dave any help for my queries. Thanks in advance.

Thiyagu

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 22, 2009 Sep 22, 2009

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 23, 2009 Sep 23, 2009

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines