Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: ScriptUI: replacing images

$
0
0

Thanks both.

 

Vamitul -- Well, yes. I now have separate PNGs that need to be in the script's folder. But I'd rather have everything in the script file. Besides, If I can't get something to work I want to know if it's really not possible

 

Marc -- That example where a graphic is replaced immediately was just to show the problem. What I'm after is a checkbox such as some of InDesign's checkboxes, which can show either of three states: on, off, or mixed.

 

var icon_on = File ('. . ./checkbox_on.png');
var icon_off = File ('. . ./checkbox_off.png');
var icon_mixed = File ('. . ./checkbox_mixed.png'); 
var w = new Window ('dialog');    var icon = w.add ('image', undefined, icon_on);    icon.id = 'on';     icon.addEventListener ('click', function () {        switch (this.id){            case'on' : {this.id = 'off'; icon.image = icon_off; break}            case'off' : {this.id = 'mixed'; icon.image = icon_mixed; break}            case'mixed' : {this.id = 'on'; icon.image = icon_on}        }    }); 
w.show();

 

This script works fine. But I can't get it to work with string variables for the icons. I rummaged around with various variants of your solution, but I guess I'm missing something because I can't get it to work.

 

Thanks,

 

Peter


Viewing all articles
Browse latest Browse all 37788

Trending Articles