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

Script errors (CC 2018)

New Here ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting

Views

444

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

Community Expert , Apr 19, 2018 Apr 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");

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

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

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
New Here ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

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:Bildschirmfoto 2018-04-19 um 17.19.43.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
Community Expert ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

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

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
New Here ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Problem solved, thank you. Has this changed? The code worked before CC 2018, I just copied it for the posted GUINEA PIG.

I had to fix the coordinates as well, since the values now are relative to the panel.

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
Community Expert ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

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.

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
Valorous Hero ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

LATEST

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.

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