Skip to main content
Participating Frequently
February 26, 2016
Answered

Using application icons

  • February 26, 2016
  • 1 reply
  • 1442 views

When I edit a  script,I want to add a iconbutton in the window;

I want to konw how to use the After Effects application icons as the iconbutton's icons ??

This topic has been closed for replies.
Correct answer David Torno

Still looking, but found this in the Javascript Tools Guide CC.pdf (pg 72). Unfortunately they mention Photoshop CC only.

The scripting environment can define icon resources, which are available to scripts by name. To specify an icon resource, set a control’s image property to the resource’s JavaScript name, or refer to the resource by name when creating the control. For example, to create a button with an application-defined icon resource:

myWin.upBtn = myWin.add ("iconbutton", undefined, "SourceFolderIcon");

Photoshop CC, for example, defines these icon resources:

Step1Icon

Step2Icon

Step3Icon

Step4Icon

SourceFolderIcon

DestinationFolderIcon

1 reply

Legend
February 26, 2016

All you need is the file path to the image itself, and to make sure it's format is a png or jpg.

The JavaScriptToolsGuideCC.pdf will have info on adding an iconButton.

//One way is like this:

var myWin = new Window("palette", "My Window", undefined);

myWin.add ("iconbutton", undefined, "PATH_TO_IMAGE_FILE"); //Adds UI to the window

myWin.center();

myWin.show();

//------------------------------------------------------------------------------------

//Another is if you are using a resource string:

var myWin2 = new Window("palette", "My Window", undefined);

var res = "group{orientation: 'row', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\

  myIconButton: IconButton{image:'PATH_TO_IMAGE_FILE', alignment:['fill', 'fill']},\

}";

myWin2.add(res); //Adds UI to the window

myWin2.center();

myWin2.show();

Participating Frequently
February 27, 2016

Thanks for your answer, but I dont want to add myown file,or in other words,I dont want to create the image file path,for example, I used the ESTK's icons:

w = new Window ("dialog"); w.orientation = "row";

w.add("iconbutton", undefined, "#Enumeration");

w.add("iconbutton", undefined, "#Class");

w.add("iconbutton", undefined, "#Method");

w.add("iconbutton", undefined, "#PropertyRO");

w.add("iconbutton", undefined, "#PropertyRW");

w.add("iconbutton", undefined, "SystemQueryIcon");

w.add("iconbutton", undefined, "SystemStopIcon");

w.add("iconbutton", undefined, "SystemExpand");

w.add("iconbutton", undefined, "SystemCollapse");

w.add("iconbutton", undefined, "#FolderOpened");

w.show();

I want to konw how to call the After Effects' icons by this way ?

Thanks.

Legend
February 27, 2016

‌AHhhhh, ok. That, I have not messed with unfortunately, so I do not have an answer for you off hand. Sorry. I'll try to do some research this weekend and see if I can find anything.