Copy link to clipboard
Copied
var w = new Window ("dialog");
w.orientation = "row";
var f = File ("C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\AMT\LMResources s\ps.ico")
w.add ("iconbutton" , undefined, f ); // a
w.add ("iconbutton" , undefined, f, {style: "toolbutton"}); // b
var t1 = w.add ("iconbutton" , undefined, f, {style: "toolbutton" , toggle: true}); // c
var t2 = w.add ("iconbutton" , undefined, f, {style: "toolbutton" , toggle: true}); // d
t2.value = true;
w.show ();
Hi
You can only use PNG or JPG.
And in the case of iconbutton, you must use ScriptUI.newImage(File("path")) and not File
var w = new Window ("dialog");
w.orientation = "row";
var f = File (Folder.desktop + "/imageName.png"); // only png or jpg
w.add ("iconbutton" , undefined, f ); // a
w.add ("iconbutton" , undefined, ScriptUI.newImage(f), {style: "toolbutton"}); // b
var t1 = w.add ("iconbutton" , undefined, ScriptUI.newImage(f), {style: "toolbutton" , toggle: true}); // c
var t2
...Copy link to clipboard
Copied
Hi
You can only use PNG or JPG.
And in the case of iconbutton, you must use ScriptUI.newImage(File("path")) and not File
var w = new Window ("dialog");
w.orientation = "row";
var f = File (Folder.desktop + "/imageName.png"); // only png or jpg
w.add ("iconbutton" , undefined, f ); // a
w.add ("iconbutton" , undefined, ScriptUI.newImage(f), {style: "toolbutton"}); // b
var t1 = w.add ("iconbutton" , undefined, ScriptUI.newImage(f), {style: "toolbutton" , toggle: true}); // c
var t2 = w.add ("iconbutton" , undefined, ScriptUI.newImage(f) ,{style: "toolbutton" , toggle: true}); // d
t2.value = true;
w.show ();
Copy link to clipboard
Copied
Pedro thanks for this
iconbutton work properly
but I have a problem
when you apply iconbutton button cancel
this does not work !!!
how can I fix?
Copy link to clipboard
Copied
Hi
for example, if you want to close panel on inconbutton 't2' you can use onClick function containing that code and put it before the w.show()
t2.onClick = function() {
w.close();
}
w.show ();
Copy link to clipboard
Copied
Pedro I solved many thanks
good day.
Copy link to clipboard
Copied
if the icon I would put it in a folder named foo
in the Documents folder
how should I proceed
What should I change in this string
var f = File (Folder.desktop + "/imageName.png"); // Only png or jpg
Copy link to clipboard
Copied
var f = File (Folder.myDocuments + "/imageName.png");
or a subfolder named "foo" inside documents folder:
var f = File (Folder.myDocuments + "/foo/imageName.png");
Copy link to clipboard
Copied
Hi, is the name of the folder from which you run the script ? Like "Folder.myDocuments", "Folder.desktop" ...
I have run the script from the HTML panel, and I need to specify the path to png's for the buttons.
Copy link to clipboard
Copied
You get it using $.fileName
This is the File reference of the script it self.
If you want to get the reference of the folder where it is strored, just use:
File(decodeURI($.fileName)).path
Copy link to clipboard
Copied
Pedro
It works very well
thank you