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

JS InDesign CS4: Check Rectangle if it contains artwork or empty.

Participant ,
Oct 22, 2009 Oct 22, 2009

Hi,

I need to check selected Rectangle if it contains Graphic or it's empty and I need to do it by checking selection, but I couldn't find anything helpful in the OMV on the Selection, and none of what I tried works.

if (app.activeDocument.selection[0].child != Graphic)

{

}

Your help is highly appriciated.

Yulia

TOPICS
Scripting
754
Translate
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 ,
Oct 23, 2009 Oct 23, 2009

Hi Yuliaart,

Try this:

var s = app.selection[0];

if( s.constructor == Rectangle && !s.graphics.length )
     {
     alert('No graphics in selected Rectangle');
     }

@+

Marc

Translate
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
Enthusiast ,
Oct 23, 2009 Oct 23, 2009

or this:

for (n = 0 ; n < app.selection.length; n++)
     {
     if(app.selection.graphics.length > 0)
          {
          make something ...
          }
     }

rübi

Translate
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
Participant ,
Oct 23, 2009 Oct 23, 2009
LATEST

Thank you, guys, it works perfectly.

Yulia

Translate
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