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

how to properly interact with the script files ?

Participant ,
Nov 15, 2015 Nov 15, 2015

Copy link to clipboard

Copied

Hi all.

I want to make sure that after processing in the script has changed the status of control elements (buttons, input fields). But to access the properties of an element I have succeeded only in main.js. And most of the processing will be in the file hostscript.jsx .

For example, btn_test1 does not show properties, and btn_test1 shows. How to interact with the js files and how do I access the properties of objects in the resource file hostscript.jsx

Edraw Mind Map (Free Version) - ww1.jpg

TOPICS
Actions and scripting

Views

266

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

Participant , Nov 15, 2015 Nov 15, 2015

Thanks for the quick reply. I found a solution ... From file jsx returns "result" = name blocked button, which is applied to the element. For one button, just for a few - need to pass an array


HTML

<table width="100%" border="0" padding="10">

<tr><td><button id="btn_test1" class ="btnType1">Test1</button></td>

<tr><td><button id="btn_test2" class ="btnType1">Test2</button></td>

</table>

JS

$("#btn_test1").click(function () {

  csInterface.evalScript('sayHello()', function(result) {

  document.getElement

...

Votes

Translate

Translate
Adobe
Enthusiast ,
Nov 15, 2015 Nov 15, 2015

Copy link to clipboard

Copied

Short version is that when you use csInterface.evalScript you send it to Photoshop JS environment ESTK to be executed, it knows documents, but not your HTML (and vice versa for the main.js). See How to Call a Function‌ for more details. It's a critical architectural decision what tasks/logic is done in the panel JS context and what in Photoshop.

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 ,
Nov 15, 2015 Nov 15, 2015

Copy link to clipboard

Copied

LATEST

Thanks for the quick reply. I found a solution ... From file jsx returns "result" = name blocked button, which is applied to the element. For one button, just for a few - need to pass an array


HTML

<table width="100%" border="0" padding="10">

<tr><td><button id="btn_test1" class ="btnType1">Test1</button></td>

<tr><td><button id="btn_test2" class ="btnType1">Test2</button></td>

</table>

JS

$("#btn_test1").click(function () {

  csInterface.evalScript('sayHello()', function(result) {

  document.getElementById(result).disabled=true;

  });

JSX

function sayHello(){

  return("btn_test2");

}

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