Help with targeting contentType with javascript


newbie problem obvious answer. having little trouble in script snippet below. in for statement, alert returns contenttype, know have object selected , can access contenttype enumeration. switch statement (the real code want process selection depending on contenttype) returns nothing. has simple answer, don’t know it.

    for(var thecounter = 0; thecounter < app.selection.length ; thecounter++){

          var thething = app.selection[thecounter].contenttype;

          alert (thething);

        

         switch(thething){

          case 'graphic_type' :

          alert("this graphic.");

          break;

         case 'text_type':

          alert("this text");

          break;

       }  //end switch item checking

 

tia

hi

 

try this:

 

for(var thecounter = 0; thecounter < app.selection.length ; thecounter++){            var thething = app.selection[thecounter].contenttype;            alert (thething);             switch(thething.tostring()){            case 'graphic_type':            alert("this graphic.");            break;           case 'text_type':            alert("this text");            break;         }    } 


More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account