5 Replies Latest reply on Jun 2, 2016 10:58 AM by 1CM69

    Exporting jsx as Binary causes menu issue in PS CC2015

    1CM69 Level 1

      Hi,

       

      I have just upgraded to CC2015 from CS6 and have been in the process of checking compatibility between my various addons, plugins & scripts etc.

       

      When using CS6 I created a small script using the ESTK CS6 & I also shared this script on my webpage but before sharing it I exported the script as a jsxbin file to obscure the code and renamed the resulting jsxbin file as jsx.

       

      This worked perfectly.

       

      Now with CC2015, I ran the same script through ESTK CC, all looked fine, exported once again as binary, renamed jsxbin to jsx & here's the issue, using the unobscured script, the script is in exactly the correct place on my Scripts menu in CC2015 but using the obscured script results in incorrect placement in the Scripts menu in CC2015.

       

      excerpt of code for Scripts menu link:

      <javascriptresource>

      <name>$$$/JavaScripts/StarTrailStacker/Menu=Star Trail Stacker by 1CM69...</name>

      <category>aaaaThisPutsMeAtTheTopOfTheMenu</category>

      </javascriptresource>

      so, again, if I leave the code as is the link to my script right at the top of the Scripts fly-out menu and it is named correctly as: Star Trail Stacker by 1CM69...

       

      If I export this scripts code as binary using ESTK CC & renamed jsxbin to jsx and then use that resulting script, my script is still in the Scripts fly-out menu but it is not placed at the top as I would like, it is in fact placed alphabetically just above the inbuilt Statistics script & is has been named just: Star Trail Stacker but not as I require as above.

       

      Is there a fix that would allow me to continue to obscure my script but would still allow the script to appear in the menu postion I wish?

       

      Kind regards..,

        • 1. Re: Exporting jsx as Binary causes menu issue in PS CC2015
          SuperMerlin Level 5

          Put the javascriptresource as plain text and encase the binary in an eval.

          Example:-

          <javascriptresource>
          <name>$$$/JavaScripts/StarTrailStacker/Menu=Star Trail Stacker by 1CM69...</name>
          <category>aaaaThisPutsMeAtTheTopOfTheMenu</category>
          </javascriptresource>
          eval("@JSXBIN@ES@2.0@MyBbyBn0ABJAnAEjzFjBjMjFjSjUBfRBFeLjIjFjMjMjPhAiXjPjSjMjEff0DzACByB");
          
          
          • 2. Re: Exporting jsx as Binary causes menu issue in PS CC2015
            1CM69 Level 1

            Thanks for replying.

             

            Am I supposed to wrap the entire binary in one single eval or does it need to be done as one eval per line of binary?

             

            Right now I have enclosed the whole binary in one eval and yes the script now shows the correct title and position in the menu but when trying to run the script PS throws an error:

             

            Error 4: Unterminated string constant.

            Line: 5

            ->  eval("@JSXBIN@ES@2.0@MyBbyBnABMnDbyBn0ABOnEbnFn0ACJnFnABXzHjFjOjBjCjMjFjEBfXzKiQjSjPjD

            any ideas?

            • 3. Re: Exporting jsx as Binary causes menu issue in PS CC2015
              1CM69 Level 1

              OK, got it now.

               

              I removed the section:

              1. <javascriptresource> 
              2. <name>$$$/JavaScripts/StarTrailStacker/Menu=Star Trail Stacker by 1CM69...</name> 
              3. <category>aaaaThisPutsMeAtTheTopOfTheMenu</category> 
              4. </javascriptresource>

               

              from the plain text .jsx file and then exported the remaining as binary .jsxbin.

               

              I renamed the .jsxbin file to .jsx opened it in ESTK CC and selected and copied the entire contents of the file then pasted it into:

               

              http://codebeautify.org/text-minifier

               

              to remove all the white space, so the whole code is retained on one single line albeit an extremely long line.

               

              I found by trial & error that importing this newly formatted code back in to ESTK CC does not work as ESTK CC does not want to reach the last digit in the line.

               

              I used my favourite editor phpDesigner and copied the minified code in to there as a blank text document.

               

              At the start of the line of code I added back the removed section above, hit return so this new long line is now on LINE 5 in the code.

               

              I then added

              eval("

              to the beginning of the line, scrolled to the end of the line and added the

              ");

              I saved this new with the extension .jsx

               

              Now it works a treat, exactly how I wanted it to.

               

              Regards..,

              • 4. Re: Exporting jsx as Binary causes menu issue in PS CC2015
                Mikaeru69 Level 3

                Alternatively, you can use the triple-quote syntax (three double-quote characters in a row) introduced in CS4 and directly paste the contents of the .jsxbin file.

                 

                Example:

                 

                1. <javascriptresource> 
                2. <name>$$$/JavaScripts/StarTrailStacker/Menu=Star Trail Stacker by 1CM69...</name> 
                3. <category>aaaaThisPutsMeAtTheTopOfTheMenu</category> 
                4. </javascriptresource> 
                5. eval("""@JSXBIN@ES@2.0@MyBbyBn0ABJAnAEjzFjBjMjFjSjUBfRBF
                6. eLjIjFjMjMjPhAiXjPjSjMjEff0DzACByB"""); 

                 

                 

                From https://www.adobe.com/content/dam/Adobe/en/devnet/scripting/pdfs/javascript_tools_guide.pd f  p. 24:

                 

                The Script Editor supports triple-quote syntax to allow strings to span several source code lines. When entering a very long string, you can:

                 

                • Enter it all on one line:

                 

                var myString = "This very long string might wrap onto a second line visually, but you typed no CR character when entering it."

                 

                • Enter on multiple lines, using a backslash (\) continuation character at the end of each line:

                 

                var myString = "This string spans \

                two lines."

                 

                • Use triple quotes around the entire string on multiple lines:

                 

                var myString = """This "quoted" word is inside the

                multiline string enclosed by triple quotes."""

                 

                The triple-quote option allows the string to contain embedded quotes.

                 

                HTH,

                 

                --Mikaeru

                2 people found this helpful
                • 5. Re: Exporting jsx as Binary causes menu issue in PS CC2015
                  1CM69 Level 1

                  Absolutely excellent, a much, much simpler procedure than my long winded attempt.

                   

                  Thank you.