3 Replies Latest reply on Sep 15, 2009 12:26 AM by Michael L Hale

    Bug in CSXS Library, Perhaps Undocumented Change in Contract


      I am making some panels for Photoshop CS4. I can communicate with Photoshop CS4 through CSXS and the Javascript DOM for Photoshop CS4.


      The panel sample for accessing layer metadata fails. The panel sample for color picker does not. Both use the following code:


      CSXSInterface.instance.evalScript("PhotoshopRegisterEvent", charToInteger("Opn ").toString());


      This works fine with the color picker sample and not with the layer metadata sample. It also crashes Photoshop when I try to use the code to change the View State based on whether a file is open already or opens.


      Since it works in one example and not in another and they were compiled at different times, it loooks like there might be a bug in different versions of the CSXS library. That, or perhaps the functionality has changed or perhaps the contract regarding input parameters?


      This is very disappointing, since I do need to create a few callbacks from Photoshop so the panel can react to changes in the current active document.





        • 1. Re: Bug in CSXS Library, Perhaps Undocumented Change in Contract
          Michael L Hale Level 5

          It's great to find someone who is making Photoshop panels. I found this post while searching for help in troubleshooting a panel I'm working on. Most of my search results where about either web or PatchPanels.


          I can tell you that at least on my system( WinXP 32 ) the PerlayerMetadata sample works. The panel I'm working on uses 8 charID events including "Opn " and 4 stringID events. That part of the panel works and the CSXSLibrary AIR Logger show the event handlers are being called without any crashes.


          My only suggestion is to make sure you have the CSXSLibrary.swc from the latest SDK.


          It's also dissappointing how little information there is on creating Photoshop panel using Flex.

          • 2. Re: Bug in CSXS Library, Perhaps Undocumented Change in Contract
            gmitchel Level 1

            Thanks, I will try to work this out on a later project. I've already moved past this issue and now have another biting me on the backside. That's getting data from the panel to the Javascript.


            This code does not work as far as invoking the Javascript action. It does raise the alert box with the correct result.


            USMParameterString = SliderUSMAmount.value.toString() + "," + SliderUSMRadius.value.toString() + "," +
                                               SliderUSMThreshold.value.toString() + "," + ComboBlend.selectedIndex.toString() + "," +

                                               StepperOpacity.value.toString() + "," + SharpeningBlendIf1Setting.toString() + "," +
                                               SharpeningBlendIf2Setting.toString() + "," + SharpeningBlendIf3Setting.toString() + "," +
                                               SharpeningBlendIf4Setting.toString() + "," + UnderlyingBlendIf1Setting.toString() + "," +
                                               UnderlyingBlendIf2Setting.toString() + "," + UnderlyingBlendIf3Setting.toString() + "," +
            CSXSInterface.instance.evalScript("applyUnsharpMaskFilter", USMParameterString);


            That's a simple string being passed. It's parsed with simple Javascript. Unfortunately, it doesn;t even get called. I can call Javascripts that do not pass a parameter. Add a string to pass parameters and no go.


            function applyUnsharpMaskFilter(params){

            var paramsTokens = params.split(",");
            amount = parseInt(paramsTokens[0]);
            radius = parseFloat(paramsTokens[1]);
            threshold = parseInt(paramsTokens[2]);
            blend = parseInt(paramsTokens[3]);
            opacity = parseInt(paramsTokens[4]);
            sharpenBlendIf1 = parseInt(paramsTokens[5]);
            sharpenBlendIf2 = parseInt(paramsTokens[6]);
            sharpenBlendIf3 = parseInt(paramsTokens[7]);
            sharpenBlendIf4 = parseInt(paramsTokens[8]);
            underlyingBlendIf1 = parseInt(paramsTokens[9]);
            underlyingBlendIf2 = parseInt(paramsTokens[10]);
            underlyingBlendIf3 = parseInt(paramsTokens[11]);
            underlyingBlendIf4 = parseInt(paramsTokens[12]);

            if (app.activeDocument.activeLayer.name == "TLR Pro USM") updateUSMLayer(amount, radius, threshold);
            else addUSMLayer(amount, radius, threshold);

            setBlendIfs(sharpenBlendIf1, sharpenBlendIf2, sharpenBlendIf3, sharpenBlendIf4,
                 underlyingBlendIf1, underlyingBlendIf2, underlyingBlendIf3, underlyingBlendIf4);


            I can find no documentation on CSXS Library. The link in the online documentation does not work. I'm beginning to believe it is flakey and unreliable.





            • 3. Re: Bug in CSXS Library, Perhaps Undocumented Change in Contract
              Michael L Hale Level 5

              I used the watermark panel from this link http://www.tranberry.com/panels/ to learn how to pass arguments from Flex to jsx. It uses what amounts to an object.toSource() string.