Skip to main content
Known Participant
February 11, 2013
Question

Controling the import icon in the character (or paragraph) styles pallette

  • February 11, 2013
  • 2 replies
  • 1578 views

When I import styles into InDesign there is an icon to the right of their name that tells me that I have not altered them within InDesign yet. As soon as I open the style and alter it that icon goes away. Very handy. I can see at a glance what I still need to work on. My problem is that when I alter those styles through a script the icon does not go away. How can I control whether that icon shows ("imported" is read-only from the scripting environment)?

Basically, for my own purposes my InDesign documents get imported with a lot of similar styles with slightly different names. I've written a script that will allow me to base a lot of styles on one master that I've set (it alters the basedOn property of the subsequent styles). But that does not get rid of the icon and so I do not know whether I still need to work on those styles that I've just set. The icon will go away if I open each by hand and save it, but that's what I'm trying to avoid with the script in the first place.

Thanks! Please let me know if you need more information, but I can't think what else I can tell you.

Andy

This topic has been closed for replies.

2 replies

Jump_Over
Legend
February 12, 2013

LetraLibre wrote:

I alter those styles through a script the icon does not go away.

...

I've written a script that will allow me to base a lot of styles on one master that I've set (it alters the basedOn property of the subsequent styles). But that does not get rid of the icon...

I case of making icon gone you could use inside your script

(right after altering basedOn property, I assumed this is inside some kind of loop):

...

mName = thisStyle.name;

mStyle = thisStyle.duplicate();

thisStyle.remove(mStyle);

mStyle.name = mName;

...

rgds

Vamitul
Legend
February 12, 2013

A character/paragraph style has the "imported" property:

importedboolreadonlyIf true, the style was imported from another document.
Known Participant
February 12, 2013

Thanks Vamitul. That property is, as I said, only read-only. InDesign can alter it--and does as soon as you alter the style inside the program--but I cannot with a script.

Known Participant
February 12, 2013

Well, I have a work-around: I've written a quick-and-dirty script that finds all the character or paragraph styles that still show imported and that are not based on any other style. I'd prefer to be able to control that icon, but this will work.

Known Participant
February 12, 2013

In case anyone ever finds a need for such a thing, here is the code for the paragraph styles version. It could be cleaned quite a bit but it is functional.

#target InDesign

var num = app.documents[0].paragraphStyles;

var my_styles = new Array;

try {

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

{

    if (app.documents[0].paragraphStyles.item(i).imported == true)

    {

        this_style = app.documents[0].paragraphStyles.item(i).name;

        //alert(this_style);

        if (this_style == "[None]")

        {

        } else {

            this_style_base = app.documents[0].paragraphStyles.item(i).basedOn.name;

            if (this_style_base == undefined)

            {

                //alert(this_style_base);

                zis_style = this_style + "\r     " + this_style_base + "\r";

                my_styles.push(zis_style);

            }

        }

    }

}

} catch (e) {

    alert(e);

    exit();

}

alert_scroll ("Imported Paragraph Styles", my_styles);

function alert_scroll (title, input){

   if (input instanceof Array)

       input = input.join ("\r");

    var w = new Window ("dialog", title);

    var list = w.add ("edittext", undefined, input, {multiline: true, scrolling: true});

    list.maximumSize.height = w.maximumSize.height-100;

    list.minimumSize.width = 550;

    w.add ("button", undefined, "Close", {name: "ok"});

    w.show ();

}