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

Statis text not updating

$
0
0

I've been looking through the forusm for a while and I can't find my answer.  User inputs text in text box, his the "Check Item" button then if its found the 'statictext' should update as its text is var veritemnum but I can't get it to update.

 

//Created by  Daryl R. Smith
//Simply takes the artwork and places it on the three up template, then saves the file with the option to resize

#target illustrator;

var veritemnum = "Item Not Found"

   //size one hats are 4.5"w x 2"h   var size1 = [7752, 8645, 7550, 7310, 7365, 7362, 7360, 7317, 7315,8630,7370,7320,7340,7220,7221,8329,8326,8331,8303,8309,8305,8300,8333,8332,   8352,];     //size 4 hats are 4"w x2.5"H   var size4 = [8311,];     //size 2 hats are 4"W x 2"h   var size2 = [7313, 8266, 8635, 8615, ];        //size 8 hats are 3.5"w x 2.5"h   var size8 = [7366,];     //size 3 hats are 3.5"W x 2"h   var size3 = [7700, 8330, ];     //size 5 visors are 3"w x 1.25"h   var size5 = [7375,];     //size 6 visors are 3.5"w x 1.25"h   var size6 = [8307,];     //size 7 visors are 4"w x 1.25"h   var size7 = [7754, 7754,7460,];

var w = new Window ('dialog', "Imprint Size Search");
    w.orientation = "row";    w.size = [300,150];       var rsizegroup = w.add ('group', undefined, undefined);    rsizegroup.orientation = "column";    rsizegroup.alignChildren = "left";         var textgroup = w.add ("group", undefined, "");    textgroup.orientation = "column";       rsizegroup.add ("statictext", undefined, "Item Number:");       var itmgrp = rsizegroup.add ('group',undefined, "");    itmgrp.orientation = "row";       var itemNum = itmgrp.add ("edittext", undefined, "");    itemNum.size = [40,20];    itemNum.active = true;       itemNum.onChange = function()    {  itemNum = this.text    itemNum.characters = 7;    itemNum.active = true;    }    var checkitem = itmgrp.add ('button', undefined, "Check item");    checkitem.onClick = function (veritemnum)    {         //size one hats are 4.5"w x 2"h            for (i=0;i<size1.length;i++)            {                if (itemNum == size1[i])                  {                  
alert ("size 1 made it");                        return "Item Found s1";                                    }//end if size 1           }//end for size 1                    //size 2 hats are 4"W x 2"h            for (j=0;j<size2.length;j++)            {                if (itemNum == size2[j])                  {                 
alert ("size 2 made it");                      return "Item Found s2";                                   }//end size 2            }//end for size 2                    //size 3 hats are 3.5"W x 2"h                  for (k=0;k<size3.length;k++)             {                if (itemNum == size3[k])                  {                 
alert ("size 3 made it");                     return "Item Found s3";                                   }//end size 3          }//end for size 3                   //size 4 hats are 4"w x2.5"H              for (h=0;h<size4.length;h++)              {                if (itemNum == size4[h])                   {                 
alert ("size 4 made it");                     return "Item Found s4";                                   }//end if size 4              }//end for size 4                            //size 5 visors are 3"w x 1.25"h                  for (j=0;j<size5.length;j++)                {                if (itemNum == size5[j])                  {               var  veritemnum = "Item Found s5";                                 
alert ("size 5 made it");                  return ("Item Found s5");                                   }//end if size 5              }//end for size 5                       //size 6 visors are 3.5"w x 1.25"h                  for (j=0;j<size6.length;j++)              {                if (itemNum == size6[j])                {             
alert ("size 6 made it");                  return "Item Found s6";                           }//end if size 6          }//end for size 6                       //size 7 visors are 4"w x 1.25"h                 for (j=0;j<size7.length;j++)              {                if (itemNum == size7[j])                  {                                                  
alert ("size 7 made it");                              return "Item Found s7";                                   }//end if size 7              }// end for size 7                       //size 8 hats are 3.5"w x 2.5"h              for (j=0;j<size8.length;j++)              {                if (itemNum == size8[j])                   {                                 
alert ("size 8 made it");                                 return ("Item Found s8");                                     }//end if size 8                }//end for size 8               }//end on check item click      var selecteditem = rsizegroup.add('statictext', undefined, veritemnum);       var rsizequestion = rsizegroup.add('button', undefined, "Resize Artwork");    
rsizequestion.onClick = function() 
{         findImprintSize();     resizeart()
};          var breakPanel2 = w.add ("panel", [0,0,2,64]);////////////////////////// Break Panel     bttngrp = w.add ('group',undefined,undefined);   bttngrp.orientation = "column";             bttngrp.add ("button", undefined, "OK");    bttngrp.add ("button", undefined, "Cancel");    //itemNum = itemNum.text;       if (w.show () == 1)    {        allstuff ()        }/*end if ok button*/ else
 {         }

 

If you put in 7375 an alert will pop up letting you know it made it through size 5 which is correct but the static text never changes.  What am I missing?


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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