Skip to main content
Dapeamel
Inspiring
July 8, 2014
Answered

masterpages and content

  • July 8, 2014
  • 1 reply
  • 1084 views

Hello guys,

I need help to write a simple function that checks if there is content/no content on a master page,

if there is content on the master pages ("You got content on the masterpages")

if there is no content on the masterpages(" You have got no content on the masterpages")

Could someone help me out,

Thank you in advance

This topic has been closed for replies.
Correct answer Kai Rübsamen

strange,

the script you written doesn't work in adobe cs 6


Hm! Sorry to hear that. I built a example with 3 masterpages in CS5.5. Masterpage A and C with some elements. Masterpage B with nothing. If I test my lines in CS5.5 and CS6 I get the attached alert.

1 reply

Chinnadk
Legend
July 8, 2014

Hi,

Try this.

var doc = app.activeDocument,

    _masters = doc.masterSpreads;

for(var i=0;i<_masters.length;i++)

{

        for(var j =0;j<_masters.pages.length;j++)

        {

                for(var k=0;k<_masters.pages.textFrames.length;k++)

                {

                        if(_masters.pages.textFrames.contents !="")

                        {

                                alert(("You got content on the masterpages"))

                            }

                        else

                        {

                                alert(" You have got no content on the masterpages")

                            }

                    }

            }

    }

Regards,

Chinna

Dapeamel
DapeamelAuthor
Inspiring
July 8, 2014

Awesome Thank you sir,

how do I include pictures?

if there is picutes also?

Thank you in advance sir.