• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

icon button_invalid image data

Community Beginner ,
Jan 28, 2016 Jan 28, 2016

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 ();

TOPICS
Actions and scripting

Views

2.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Feb 01, 2016 Feb 01, 2016

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

...

Votes

Translate

Translate
Adobe
Enthusiast ,
Feb 01, 2016 Feb 01, 2016

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 ();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 02, 2016 Feb 02, 2016

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 02, 2016 Feb 02, 2016

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 ();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 02, 2016 Feb 02, 2016

Copy link to clipboard

Copied

Pedro I solved many thanks

good day.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 02, 2017 Mar 02, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 02, 2017 Mar 02, 2017

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");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 05, 2017 May 05, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 05, 2017 May 05, 2017

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 03, 2017 Mar 03, 2017

Copy link to clipboard

Copied

Pedro

It works very well

thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines