Skip to main content
d_sandberg
Participant
August 21, 2014
Question

Square meter info

  • August 21, 2014
  • 2 replies
  • 1820 views

Is it passable the see the square meters (m2) of a dokument in a easy way? I don't want to manually count hundred of documents...

This topic has been closed for replies.

2 replies

Legend
August 21, 2014

You can use the below code to count the number of square meter in multiple Indesign documents:

var InddFile = File.openDialog ("Choose InDesign files to count square meter..." , "*.indd", true);

for (var f = 0; f < InddFile.length; f++)

{

    count=0;

    var myInddFile = app.open(File(InddFile));

    var myDoc = app.activeDocument;

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.findWhat = "m2";

    found = app.activeDocument.findGrep (true);

    for (i = 0; i < found.length; i++)

    {

        if(found.characters[1].position.toString() == "SUPERSCRIPT")

        {

            count++;

        }

    }

    app.findGrepPreferences = app.changeGrepPreferences = null;

    alert("File Name:\t" + myDoc.name + "\rSq. Mtr Count:\t" + count);

}

Vandy

pixxxelschubser
Community Expert
Community Expert
August 21, 2014

vandy88,

it seems to be nice. But IMHO this is a dangerous solution without to know what the contents of the documents is.

Look here for different examples of M2 (and thats not all):

M2 - Wikipedia, the free encyclopedia

Waiting for more infomation from d.sandberg seems to be useful.

pixxxelschubser
Community Expert
Community Expert
August 21, 2014

How is formatted your (m2) ?

If is not formatted, you can use a paragraph style with grep style:

\bm2\b

perhaps with red color character style (only to see every found)

If you want to format the m(2), you can use a different grep style e.g.

(?<=\bm)2\b

character style: position superscript (+perhaps a color)

(And sorry for my bad english)

Have fun