Skip to main content
photogyulai
Inspiring
September 2, 2015
Question

Photoshop scripting UI image or icon

  • September 2, 2015
  • 2 replies
  • 3670 views

Hey There!

Im trying to getting familiar with photoshop script UI but i have some issues:

I guess it is pretty simple but i did not have any example so i have got no idea!

My goal is to use an image or icon in a window, during script.

So here is this code:

var dlg = new Window('dialog', 'Alert Box Builder',[100,100,480,245]);

dlg.btnPnl = dlg.add('panel', [15,50,365,115], '');

dlg.btnPnl.cancelBtn = dlg.btnPnl.add('button', [235,15,335,45],

'Cancel', {name:'cancel'});

dlg.show();

Just a window with a Cancel button.

I want to add icon and/or image to this window.

Any help would be appreciated!

ps: I looked the http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/photoshop/pdfs/JavaScriptReferenceGuide.pdf   but i guess this part is missing the examples.

This topic has been closed for replies.

2 replies

Pedro Cortez Marques
Brainiac
September 3, 2015

Try this manual that has the examples you want and much more. The PDF link is there.

ScriptUI for dummies | Peter Kahrel

I have to note that there are some scriptUI bugs that are not working on photoshop.

photogyulai
Inspiring
September 4, 2015

Pedro thanks!

It looks pretty detalied, and i see some examples... so i hope the best!

Chuck Uebele
Community Expert
September 3, 2015

Use something like:

var imageFile = new File([path&filename]);

//.... inside of dialog code

dlg.imageYouWant = dlg.add('image',[undefined or placement],imageFile);

I'm hearing jpgs aren't working, so use png.

photogyulai
Inspiring
September 4, 2015

Dear Chuck!
Thank You!
My main problem is the lack of examples ... programing is pretty syntax sensitive!

I came up with this and it worked :-)
dlg.kep = dlg.msg1.add('image', {x:100, y:50, width:70, height:70}, '~/desktop/Photoshop%20scripting/photo_60x60_icon.png');

I hope with your description and this line above the next googler will find a solution :-)

I still wondering if i want to send/share my extension, than how to set the filepath (as you see above is kind of absolute or pc specific.

I tried relative path but didnt worked...

I guess the "starting point" of the path was not the directory where i had start my .jsx/script

Any thought's on that anybody?!

Chuck Uebele
Community Expert
September 4, 2015

I like to think of scripting as a massive combination lock - one typo and it doesn't open. Yes, the lack of examples makes things difficult. I've been dabbling at this since PS CS, and I still have trouble with the SDK. For assets, I would create a folder in the personal folder rather than the desktop. People don't like clutter for other people there.