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

simple javascript with .onClick function not working. I have the following small script, and cannot figure out why it is not running through. any ideas?

$
0
0

#target Illustrator 

#targetengine main 

 

// Function

function count_selected_objects(){

   

    alert ("Start of function"); /// works OK!

   

    var myDocument = app.activeDocument; 

    var items = selection;

    var totalSelected = items.length;

   

    for ( var i = 0 ; i < totalSelected ; i++){

        //var my_elementy = app.activeDocument.selection[i];

        alert("No. "+i);

    }

}

 

// Palette Window

    var win = new Window("palette", "Count elements");

    win.alignChildren = "fill";

   

    win.my_button = win.add("button",undefined, "Run");

    win.my_button.onClick = function(){ 

        count_selected_objects(); 

    }

 

    win.show();


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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