2 Replies Latest reply on Nov 15, 2015 4:32 AM by AndreyLarush

    how to properly interact with the script files ?

    AndreyLarush Level 1

      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

        • 1. Re: how to properly interact with the script files ?
          matias.kiviniemi Level 3

          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.

          1 person found this helpful
          • 2. Re: how to properly interact with the script files ?
            AndreyLarush Level 1

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

            }