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

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

Participant ,
Oct 22, 2009 Oct 22, 2009

Copy link to clipboard

Copied

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

Views

623

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

Copy link to clipboard

Copied

Hi Yuliaart,

Try this:

var s = app.selection[0];

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

@+

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

Copy link to clipboard

Copied

or this:

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

rübi

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

Copy link to clipboard

Copied

LATEST

Thank you, guys, it works perfectly.

Yulia

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