Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

IDENTIFIER INDIRECTION to compile a multi-coloured text string of the SWATCHES USED IN A DOCUMENT

$
0
0

I don't know how to use identifier indirection in JavaScript, being new to scripting and JS.

 

Screen Shot 2015-07-14 at 12.04.08.png

 

I've got as far as the first item in the picture by using MuppetMark's response (2011) to TimLogoChair

about putting used colours into a list an Illustrator document - my adaptation (leaving out the creation

of the box and the text string):

 

    function usedSwatches() { 

          

         if (app.documents.length == 0) { 

               

              return; 

               

         } else { 

     

              var idoc = app.activeDocument; 

               

              var docW = idoc.width; 

               

              var docH = idoc.height; 

               

              var sL = idoc.swatches;       

                       

             

              var colourname=[];

     

              for (var z = 0; z < sL.length; z++) {

                   var usedcolour

                   if (sL[z].name != '[None]' && sL[z].name != '[Registration]') {

                        usedcolour=sL[z].name;

                        colourname.push(usedcolour.toUpperCase())

                   }      

               }

  usedSwatches();

 

I want to read each swatch into a separate string in of the colour of its name and then concatenate them together

and put them inside the box as shown.

 

I'm sure it's easy if you know how, but I have no idea what the JavaScript equivalent of this type of anciente dosse-

based (Arcplus) programminge fromme ye laste centurie woulde bee:

 

local col, c

col=4:c=1

loop

  a$="col"+str(c,2,0)+"$"

  ar$="array"+str(c,2,0)+"$"

  rem here assign a value to array(c)$

  let @a$=value(ar$)

  c=c+1

until (c>col)

 

and my researches on the net have not given me the answer (though I will keep looking: I think it's kind of "?"/eval() =

the "@"/value above.  Probably looking for it by the wrong name ……..! 

 

Could anyone help, please?


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>