Skip to main content
Participating Frequently
April 19, 2018
Answered

Script errors (CC 2018)

  • April 19, 2018
  • 3 replies
  • 842 views

Hi,

I wrote some years ago a javascript, which worked fine up to PS CC 2014. Recently I tried to run it in PS CC 2018 and it failed. The script creates a  window with various panels containing various buttons and checkboxes. In CC 2018 only the main window and the panels show up, but not the elements within the panels. Code like

win.pnl01.selFolderButton = win.add("button",[320, 140, 420, 160] , "SELECT");

is obviously ignored.

Any suggestions?

Thanks.

This topic has been closed for replies.
Correct answer Chuck Uebele

You're adding the buttons to the main win. You need to specify that you're adding them to the panel in the add comment

win.pnl01.selFolderButton = win.pnl01.add("button", [320, 140, 420, 160] , "Select");

3 replies

Legend
April 19, 2018

This works in CS6 but not in CC2018

var win = new Window("dialog", "GUINEA PIG", [150, 150, 600, 900]);

win.add("panel", [10,10,440,180], 'Select a folder');

win.add("button", [320, 140, 420, 160] , "Select");

win.add("statictext",[30,50,430,90], "None yet selected");

win.show ();

This works in CC2018 but not in CS6

var win = new Window("dialog", "GUINEA PIG", [150, 150, 600, 900]);

win.add("button", [320, 140, 420, 160] , "Select");

win.add("statictext",[30,50,430,90], "None yet selected");

win.add("panel", [10,10,440,180], 'Select a folder');

win.show ();

Changed the order of drawing. Therefore, the panel overlaps the rest of the elements.

Chuck Uebele
Community Expert
Community Expert
April 19, 2018

I don't think it changed. AFAIK, you always had to state the exact panel or group in which a control is to be placed.

Chuck Uebele
Community Expert
Community Expert
April 19, 2018

That line looks fine, so it's hard to tell without seeing more of the code.

Participating Frequently
April 19, 2018

app.preferences.rulerUnits = Units.CM;

var win = new Window("dialog", "GUINEA PIG", [150, 150, 600, 900]);

win.pnl01 = win.add("panel", [10,10,440,180], 'Select a folder');

win.pnl01.selFolderButton = win.add("button", [320, 140, 420, 160] , "Select");

win.pnl01.selFolderToCheckTxt = win.add("statictext",[30,50,430,90], "None yet selected");

win.show ();

I broke the code up and wrote this basic script, saved and ran it. This is the result:

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
April 19, 2018

You're adding the buttons to the main win. You need to specify that you're adding them to the panel in the add comment

win.pnl01.selFolderButton = win.pnl01.add("button", [320, 140, 420, 160] , "Select");