-
1. Re: Swatches renaming using Java script
milligramme Aug 10, 2010 9:46 PM (in response to Green4ever)Try to skip if Swatch Object is consisted with [Tint Object] in for loop.
for(i = 4; i<myDocument.swatches.length; i++){
if(myDocument.swatches.item(i).getElements()[0].constructor.name==='Tint'){
continue;
}
var mySwatchName = myDocument.swatches.item(i).name;
myDocument.swatches.item(i).name = "XX_" + mySwatchName;
} -
2. Re: Swatches renaming using Java script
Green4ever Aug 11, 2010 10:47 AM (in response to milligramme)Hi
I've tried your solution but it is not working for me... Did you got the result?
Thanks....
-
3. Re: Swatches renaming using Java script
milligramme Aug 11, 2010 5:47 PM (in response to Green4ever)Hi
I've copied the code and tried again, but it does not work because "Tint" was splited by SPACE such as "T int" when I pasted here.
I pasted The code again but it will be added SPACE between 'T' and 'int'.??? Sorry, please remove SPACE and try again.
if(myDocument.swatches.item(i).getElements()[0].constructor.name==='Tint'){
It works for me on OSX 10.6.4+InDesign CS3, CS4.
Gradient Swatch, Color Swatch ==> renamed
Tint Swatch ==> based on Color Swatch
thanks
-
4. Re: Swatches renaming using Java script
Green4ever Aug 11, 2010 8:49 PM (in response to milligramme)Hi milligramme,
It is working fine now.....
Thank u very much for ur help...
if(myDocument.swatches.item(i).getElements()[0].constructor.name==='T int'){
And one more doubt why we have to use triple "equalto(=)" symbol? Usually for comparing we use double " = " symbol only.
Beacause now i'm in learning stage... can u tell me if u have time?
-
5. Re: Swatches renaming using Java script
dhishok Aug 12, 2010 10:13 PM (in response to Green4ever)Hi Green4ever,
The "===" is for cheking/comparing the value, as well as its type (String / integer) in one shot.
Thanks
ashok

