UI / Background image

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Kukurykus, Tom, xbytor

Mr Maze

UI / Background image

Post by Mr Maze »

Hi everyone,

I am currently working on a scripting interface for CS3, and doing most of my devel on a Mac. I found a problem and wanted to know if anyone could duplicate it.

On the Mac, I have made a background image that covers the entire UI in order to make it have a more plug-in feel (I am using the CS3 code that lets the script show up in the Filters menu also). Everything works great on the Mac, but on Windows Panels/Groups/Static Text etc have an opaque background which covers up the background image.

I don't have my project here at home, but I won't be able to post up the code from it anyway (you know, work legalities and such) but if anyone wants me to make an example I can code one up tonight.

Mr Maze

UI / Background image

Post by Mr Maze »

Ok here is a working example for OSX:
Code: Select allfunction main() {

dlg1 = new Window ('dialog', 'Background Image Example', [0,0,600,458]);

interfaceImage = dlg1.add ('image', [0,0,600,458], (app.path+"/Presets/Scripts/interface.png"));

topgroup = dlg1.add ('group', [0,0,600,226]);
   
pickTextures = topgroup.add ('statictext', [10,10,300,30], 'Push a button:', {scrolling:false,multiline:false});
      
setabutton = topgroup.add ('button', [10,40,230,60], 'Button A', );
setabutton.enabled = false;
   
setbbutton = topgroup.add ('button', [10,70,230,90], 'Button B');

bottomgroup = dlg1.add ('group', [10,230,590,530]);

infoText = bottomgroup.add ('statictext', [0,10,580,200], 'Here is a bunch of text to go in this space. On the Mac it is transparent, you can see the background through the text. On a Windows XP machine, in CS3, the text does not show the background beneath the text. It is really quite perplexing and annoying. I am really hoping it is just user/creator error.', {scrolling:false, multiline:true});                                                         

helpBtn = bottomgroup.add ('button', [0,190,20,210], 'Help');
quitBtn = bottomgroup.add ('button', [80,190,100,210], 'Quit', {name:'cancel'},);

// onClick definitions
//helpBtn.onClick = function() DO SOMETHING;
setabutton.onClick = function() {
   setabutton.enabled = false;
   setbbutton.enabled = true;
   };

setbbutton.onClick = function() {
   setabutton.enabled = true;s
   setbbutton.enabled = false;
   };
               
dlg1.center();

dlg1.show();

}

main()

What strikes me as odd is on the PC side you have to call the image last:
Code: Select allfunction main() {

dlg1 = new Window ('dialog', 'Background Image Example', [0,0,600,458]);



topgroup = dlg1.add ('group', [0,0,600,226]);
   
pickTextures = topgroup.add ('statictext', [10,10,300,30], 'Push a button:', {scrolling:false,multiline:false});
      
setabutton = topgroup.add ('button', [10,40,230,60], 'Button A', );
setabutton.enabled = false;
   
setbbutton = topgroup.add ('button', [10,70,230,90], 'Button B');

bottomgroup = dlg1.add ('group', [10,230,590,530]);

infoText = bottomgroup.add ('statictext', [0,10,580,150], 'Here is a bunch of text to go in this space. On the Mac it is transparent, you can see the background through the text. On a Windows XP machine, in CS3, the text does not show the background beneath the text. It is really quite perplexing and annoying. I am really hoping it is just user/creator error.', {scrolling:false, multiline:true});                                                         

helpBtn = bottomgroup.add ('button', [0,190,80,210], 'Help');
quitBtn = bottomgroup.add ('button', [100,190,180,210], 'Quit', {name:'cancel'},);

// onClick definitions
//helpBtn.onClick = function() DO SOMETHING;
setabutton.onClick = function() {
   setabutton.enabled = false;
   setbbutton.enabled = true;
   };

setbbutton.onClick = function() {
   setabutton.enabled = true;
   setbbutton.enabled = false;
   };

interfaceImage = dlg1.add ('image', [0,0,600,458], (app.path+"/Presets/Scripts/interface.png"));

dlg1.center();

dlg1.show();

}

main()

Please note that you will have to make a PNG that is 600 pixels wide and 458 pixels tall, and place it in your Photoshop scripts directory. I made an image but did not see anywhere to attach it to this post...

Patrick

UI / Background image

Post by Patrick »

I haven't looked through your post yet, but just wanted to let you know you can upload files to the upload forum.

Patrick

Mr Maze

UI / Background image

Post by Mr Maze »

Attachments
interface.png.zip
(155.86 KiB) Downloaded 10 times

Mr Maze

UI / Background image

Post by Mr Maze »

Bump

xbytor

UI / Background image

Post by xbytor »

Mr Maze wrote:(I am using the CS3 code that lets the script show up in the Filters menu also)

What CS3 code? Did I miss something or am I forgetting something?

-X

Mr Maze

UI / Background image

Post by Mr Maze »

xbytor wrote:Mr Maze wrote:(I am using the CS3 code that lets the script show up in the Filters menu also)

What CS3 code? Did I miss something or am I forgetting something?

-X

Here is the code that has to be at the top of the script:

Code: Select all/*
<javascriptresource>
<name>$$$/JavaScripts/ScriptFileNameHere/Name=Script Menu Name Here</name>
<about>$$$/JavaScripts/ScriptFileNameHere/About=Information about your script here.</about>
<menu>filter (I am using filter menu, not officially supported but works!)</menu>
<enableinfo>true</enableinfo>
</javascriptresource>
*/

I pulled most of this info from example scripts in the PS3 install as well as from the resource PDFs. Please note that your script has to be in the Presets>Scripts directory for this to work correctly (in case you didn't gather that from the code above).

xbytor

UI / Background image

Post by xbytor »

"automate", "filter", and "help" are all now officially supported in CS4 according the docs.

This might come in handy.

-X

Mr Maze

UI / Background image

Post by Mr Maze »

Yes, very handy - I like it very much.

But back to my original question - does anyone know why I can't blanket the background of an interface on the PC to make it pretty? Is it just how Windows handles um, windows?

Well, I will run a couple more tests today on Win XP. Haven't had time to see what Vista does yet.

xbytor

UI / Background image

Post by xbytor »

It's probably just the way things work in Windows vs. Mac.

For instance, I have UI code that creates static text on the Mac and readonly edit-text on WinXP just to get the a consistent look across the two UIs.

I also have 'isCS3() ' code to fix statictext alignment issues because it changed behaviour in that upgrade.

-X