2 Replies Latest reply on Jan 20, 2015 3:44 PM by DBarranca

    PS Script partial binary coding - how?

    Beholder003 Level 1

      Hi,

       

      I have a PS .jsx script which I want to finalize and give to some other users.

      Since there are some variables and filepaths which depend on the user environment the users need to and shall be able to change them in the source to their personal preferences.

      This bit covers the first 20 or so source lines.

       

      After that the code is fixed and I do not want them to change it. Now I do know I can export stuff as binary as a whole but that would cause everything to be unreadable and unchangeable - not desired.

      If have seen a script which did behave like what I wanted but I do not know how to do it myself.

      The other thing put some scrambled stuff in between eval("..........");

      And the lines in there always end with a backslash.

       

      Any hints?

        • 1. Re: PS Script partial binary coding - how?
          matias.kiviniemi Level 3

          It depends a bit on how you are distributing (Addons/ZXP/JSX) and running (Scripts-menu, Flash/HTML-Panel), but have you considered

          1. Put the customizable part to a text file, deliver it with your script and read the settings from your binary.
          2. Put the customizable part to web server to be downloaded once (even Dropbox.
          3. Split your script in plaintext and binary parts and eval the plaintext
          • 2. Re: PS Script partial binary coding - how?
            DBarranca Level 4

            Me too, I would suggest the first workaround Matias mentioned.

             

            In case you want to keep everything simple on one file only, just cut the first X lines (do not save), export as binary, open the binary file, wrap everything with eval(""); add backslashes on carriage returns and then eventually paste back the X lines on top.

             

            You'll end up with something like:

             

            var a = "ABCD",
               b = "_1975";
            
            // =================================
            // = Do not modify the lines below =
            // =================================
            
            eval("@JSXBIN@ES@2.0@MyBbyBn0ALJCnASzGiNiPiEiViMiFByBneHiQiTiVjUjJjMjTffJEnAUzCjcjcCEX\
            zOjIjBjTiPjXjOiQjSjPjQjFjSjUjZDfXzGjHjMjPjCjBjMEfjzBhEFfRBVBfyBffENyBnAMEbyBn0A\
            ...
            2jRCn0ABJ2jRCnAFeGjDjBjOjDjFjMAGjN40BiAjC4B0AiAB4C0AiA2hOB4D0AiAjB4E0AiA2hPB4F0\
            AiAAGAGByB");
            

             

            Mind you, if you happen do distribute that on Adobe Add-ons as a part of an extension, the fact you let users modify a deployed file would cause the signing/timestamping check to fail -> as a result the panel will display as blank.

            Regards

             

            Davide Barranca

            ---

            www.davidebarranca.com

            www.cs-extensions.com