Discussion:
Select all object by object type?
(too old to reply)
s***@adobeforums.com
2007-07-05 17:31:50 UTC
Permalink
Hello folks,

due to some help from a forum member here, I've figured out a better way to structure my document. So, I'm hoping to figure out if there is a way to select all of a certain type of object in my document so I can make adjustments to all of them at once.

For instance, I'd like to select all text boxes in my document so I can move them to a layer for just text. I've just started using layers and they are making more and more sense to me now. I have them organized with Object styles so maybe I can "find" all objects with Object Style Basic Text Box applied to them?

any ideas about how to select things like that?

Thanks,
Spencer
D***@adobeforums.com
2007-07-05 18:07:07 UTC
Permalink
Are you looking for a user interface feature or a script? The kinds of thing you want to do can be scripted but in the UI, a selection of objects cannot extended beyond the active spread. A text selection can, but that's a different kettle of fish.

Dave
s***@adobeforums.com
2007-07-05 18:12:06 UTC
Permalink
I think I can handle a script if relatively simple. Basically, I'd want to move all objects of a certain style to a different layer without having to select them individually.

Thanks!
D***@adobeforums.com
2007-07-05 18:24:53 UTC
Permalink
Presumably all these items are freestanding in the document?

If so, you can use the appliedObjectStyle and itemLayer properties of the page items of the document, something like this:

aDoc = app.documents[0];
myPIs = aDoc.pageItems;
for (j = myPIs.length - 1; j >= 0; j--) {
if(myPIs[j].appliedObjectStyle.name == "OstyleName") {
myPIs[j].itemLayer = "MyLayer";
}
}

Sustitutue your names for the style and the layer and this should work.

Dave
O***@adobeforums.com
2007-07-05 18:57:30 UTC
Permalink
Hi Spencer,

You might want to take a look at the SelectObjects example script. It'll select objects based on their type--text frames, frames containing images, ellipses, rectangles, graphic lines, and so on. You can find it at:

<http://www.adobe.com/products/indesign/xml_scripting.html>

...and then click the Scripting tab to go to the scripting page.

Thanks,

Ole
s***@adobeforums.com
2007-07-05 19:09:20 UTC
Permalink
Thanks Dave and Ole.

I'm trying to implement Dave's suggestion but I get a "null is not an object" error # 21.

What am I doing wrong? I'm a beginner to scripting in ID but have some experience in other apps with VB and a little JS.

thanks again, everyone,

spencer
D***@adobeforums.com
2007-07-05 19:28:18 UTC
Permalink
That's a JavaScript I posted. The names have to be exactly right -- JavaScript hardly blinks an eye if you leave the semicolon off the end of a line, but it is utterly anal about capitalization of names.

For example, referring to a layer named "MyLayer" when it doesn't exist will create a null object.

Dave

Loading...