13 Replies Latest reply: Aug 10, 2012 7:39 AM by DBarranca RSS

    ESTK random error at ActionManager code

    DBarranca Community Member

      Hi,

      I'm getting stuck with random ESTK errors about ActionDescriptors/ActionReferences:

       

      DB_ 2012-08-10 at 10.49.15.png

      I've scripts involving them and, sometimes, the script halts at innocuous lines like the one above (yes, Photoshop is the target, if you're wondering )

      There's no way to get through it, I've to reboot PS and everything (the very same script) runs fine again - yet it's quite annoying while debugging.

      Mac OSX Mountain Lion, PS CS6 - resetted PS prefs, disk permissions ok... what else, voodoo?

       

      Thanks in advance

       

      Davide

        • 1. Re: ESTK random error at ActionManager code
          Paul Riggott Community Member

          The first thing to try is put the whole code in a try catch block and alert any error that it can produce.

          • 2. Re: ESTK random error at ActionManager code
            DBarranca Community Member

            Hi Paul, I did it but it's not very informative though: "Error: ActionDescriptor"

             

            Davide

            • 3. Re: ESTK random error at ActionManager code
              Paul Riggott Community Member

              Oh dear, the next step would be to bin the Mac and get a PC

              • 4. Re: ESTK random error at ActionManager code
                DBarranca Community Member

                I'm afraid I'm running out of sense of humour

                 

                So far, I can't develop anymore - I launch a script, runs smoothly, relaunch it ZAC, ActionDescriptor error, and there's no way to create a new ActionScript object anymore, anywhere (in a new, blank script for instance) with any ESTK and PS version.

                What kind of preference file could I manually delete? (already did the above mentioned steps, prefs, permissions - I'm not that confident that it's a pref problem anyway)

                 

                 

                • 5. Re: ESTK random error at ActionManager code
                  xbytor2 Community Member

                  Uninstall/reinstall PS. That would be my next step.

                  • 6. Re: ESTK random error at ActionManager code
                    Paul Riggott Community Member

                    Ok, have you tried creating another userId on the machine and try that?

                    • 7. Re: ESTK random error at ActionManager code
                      DBarranca Community Member

                      Paul, yes already done, no luck.

                      X, that's what I'm up to right now Have you ever heard of such a problem before? That's totally new to me.

                      • 8. Re: ESTK random error at ActionManager code
                        xbytor2 Community Member

                        Have you ever heard of such a problem before?

                         

                        Yep. I would see it when trying to create a new Window object. PITA. I think I fixed it by doing a reinstall and resetting preferences. That was a couple of years ago.

                        • 9. Re: ESTK random error at ActionManager code
                          DBarranca Community Member

                          Ok, things are getting tough.

                          I've disinstalled / reinstalled PS to no avail. Next step is the complete Creative Suite killing, even though ESTK should have been reinstalled along with PS.

                          Still with ears like satellite parabolas looking for suggestions.

                          Thanks

                           

                          D.

                           

                          Would it be possible that I've written an evil script that cause PS to break?! I'll be happy to share it with anyone ;-)

                          • 10. Re: ESTK random error at ActionManager code
                            Muppet Mark Community Member

                            Well I would have started by dumping prefs… Toolkit first, then app, then look at installs… Sorry don't have CS6 I have had the debugger do something similar in other app and this fixed my issue…
                            ( user library btw )

                            • 11. Re: ESTK random error at ActionManager code
                              DBarranca Community Member

                              Currently, even uninstalling and reinstalling (deleting prefs - and I'm quite sure ESTK prefs went away as well because it opened with its peculiar small fonts that I'm used to boost) the entire Creative Suite did not help

                              I'm start wondering whether the problem could lie in the script, that somehow corrupts something, even though the probability that this would be the case seems unlikely - to me.

                              Rather unhappy business, aka PITA.

                              • 12. Re: ESTK random error at ActionManager code
                                DBarranca Community Member

                                Ok, time to share - does the following works with you?

                                 

                                The exact, repeatable steps that cause me troubles are:

                                1. I create in PS a new document (whatever size), RGB, 8bit.

                                2. Run the script (below the code) in ESTK

                                3. Wait for it to create the layers it has to create, then when it's done:

                                4. Select in the History Palette the initial snapshot (i.e. I return back in time to the blank document)

                                5. Run again the script in ESTK.

                                6. Bang! (at least to me, it stops at line 209, the first ActionDescriptor in the createCurvesAdjLayer function

                                 

                                You're maybe more lucid than me to find something wrong in it.

                                (the actual script is really small, it's after a whole bunch of utility functions - please borrow them if you're in need )

                                 

                                // Generated by CoffeeScript 1.3.3
                                
                                
                                // A bunch of utility functions ===============
                                
                                
                                var blendModes, c2s, c2t, s2t, t2s, w,
                                  __slice = [].slice;
                                
                                
                                w = function(txt) {
                                  return $.writeln(txt);
                                };
                                
                                
                                c2t = function(charID) {
                                  return app.charIDToTypeID(charID);
                                };
                                
                                
                                s2t = function(stringID) {
                                  return app.stringIDToTypeID(stringID);
                                };
                                
                                
                                t2s = function(typeID) {
                                  return app.typeIDToStringID(typeID);
                                };
                                
                                
                                c2s = function(charID) {
                                  return app.typeIDToStringID(c2t(charID));
                                };
                                
                                
                                blendModes = {
                                  "Normal": "normal",
                                  "Dissolve": "dissolve",
                                  "Darken": "darken",
                                  "Multiply": "multiply",
                                  "Color Burn": "colorBurn",
                                  "Linear Burn": "linearBurn",
                                  "Darker Color": "darkerColor",
                                  "Lighten": "lighten",
                                  "Screen": "screen",
                                  "Color Dodge": "colorDodge",
                                  "Linear Dodge": "linearDodge",
                                  "Lighter Color": "lighterColor",
                                  "Overlay": "overlay",
                                  "Soft Light": "softLight",
                                  "Hard Light": "hardLight",
                                  "Vivid Light": "vividLight",
                                  "Linear Light": "linearLight",
                                  "Pin Light": "pinLight",
                                  "Hard Mix": "hardMix",
                                  "Difference": "difference",
                                  "Exclusion": "exclusion",
                                  "Subtraction": "blendSubtraction",
                                  "Divide": "blendDivide",
                                  "Hue": "hue",
                                  "Saturation": "saturation",
                                  "Color": "color",
                                  "Luminosity": "luminosity"
                                };
                                
                                
                                PSUtils = function PSUtils() {};
                                
                                
                                PSUtils.getBlendMode = function(blendString) {
                                  return s2t(blendModes[blendString]);
                                };
                                
                                
                                PSUtils.makeSO = function(layer) {
                                  var doc, newSO;
                                  doc = app.activeDocument;
                                  layer = layer != null ? layer : doc.activeLayer;
                                  if (doc.activeLayer !== layer) {
                                    doc.activeLayer = layer;
                                  }
                                  try {
                                    newSO = s2t('newPlacedLayer');
                                    executeAction(newSO, void 0, DialogModes.NO);
                                    return doc.activeLayer;
                                  } catch (error) {
                                    w("error: " + error);
                                    return void 0;
                                  }
                                };
                                
                                
                                PSUtils.clipLayer = function() {
                                  var d, r;
                                  d = ActionDescriptor;
                                  r = ActionReference;
                                  r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
                                  d.putReference(s2t('target'), r);
                                  return executeAction(s2t('groupEvent'), d, DialogModes.NO);
                                };
                                
                                
                                PSUtils.selectLayersByName = function() {
                                  var d, firstLayer, layer, r, secondLayer, _i, _len;
                                  firstLayer = arguments[0], secondLayer = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
                                  PSUtils.deselectAllLayers();
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  for (_i = 0, _len = arguments.length; _i < _len; _i++) {
                                    layer = arguments[_i];
                                    r.putName(s2t('layer'), layer);
                                  }
                                  d.putReference(s2t('target'), r);
                                  d.putEnumerated(s2t('selectionModifier'), s2t('selectionModifierType'), s2t('addToSelectionContinuous'));
                                  d.putBoolean(s2t('makeVisible'), false);
                                  return executeAction(s2t('select'), d, DialogModes.NO);
                                };
                                
                                
                                PSUtils.selectLayersByArtLayer = function() {
                                  var d, firstArtLayer, item, layer, r, secondArtLayer, _i, _len;
                                  firstArtLayer = arguments[0], secondArtLayer = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
                                  PSUtils.deselectAllLayers();
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  for (_i = 0, _len = arguments.length; _i < _len; _i++) {
                                    item = arguments[_i];
                                    layer = item.name;
                                    r.putName(s2t('layer'), layer);
                                  }
                                  d.putReference(s2t('target'), r);
                                  d.putEnumerated(s2t('selectionModifier'), s2t('selectionModifierType'), s2t('addToSelectionContinuous'));
                                  d.putBoolean(s2t('makeVisible'), false);
                                  return executeAction(s2t('select'), d, DialogModes.NO);
                                };
                                
                                
                                PSUtils.hasLayerMask = function(layer) {
                                  var d, hasMask, r, wasActive;
                                  if (layer != null) {
                                    wasActive = app.activeDocument.activeLayer;
                                    app.activeDocument.activeLayer = layer;
                                  } else {
                                    layer = app.activeDocument.activeLayer;
                                  }
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
                                  d = executeActionGet(r);
                                  hasMask = d.hasKey(s2t('userMaskEnabled'));
                                  if (wasActive != null) {
                                    app.activeDocument.activeLayer = wasActive;
                                  }
                                  return hasMask;
                                };
                                
                                
                                PSUtils.deleteLayerMask = function(layer) {
                                  var d, layerName, r;
                                  layerName = layer != null ? layer.name : app.activeDocument.activeLayer.name;
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  r.putEnumerated(s2t('channel'), s2t('channel'), s2t('mask'));
                                  r.putName(s2t('layer'), layerName);
                                  d.putReference(s2t('target'), r);
                                  return executeAction(s2t('delete'), d, DialogModes.NO);
                                };
                                
                                
                                PSUtils.deselectLayer = function() {
                                  var d, item, layer1, layer2, r, _i, _len, _results;
                                  layer1 = arguments[0], layer2 = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
                                  _results = [];
                                  for (_i = 0, _len = arguments.length; _i < _len; _i++) {
                                    item = arguments[_i];
                                    d = new ActionDescriptor();
                                    r = new ActionReference();
                                    r.putName(s2t('layer'), item.name);
                                    d.putReference(s2t('target'), r);
                                    d.putEnumerated(s2t('selectionModifier'), s2t('selectionModifierType'), s2t('removeFromSelection'));
                                    d.putBoolean(s2t('makeVisible'), false);
                                    _results.push(executeAction(s2t('select'), d, DialogModes.NO));
                                  }
                                  return _results;
                                };
                                
                                
                                PSUtils.deselectAllLayers = function() {
                                  var d, r;
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
                                  d.putReference(s2t('target'), r);
                                  return executeAction(s2t('selectNoLayers'), d, DialogModes.NO);
                                };
                                
                                
                                PSUtils.deleteSmartFilterMask = function(layer) {
                                  var d, layerName, r;
                                  layerName = layer != null ? layer.name : app.activeDocument.activeLayer.name;
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  r.putEnumerated(s2t('channel'), s2t('channel'), s2t('filterMask'));
                                  r.putName(s2t('layer'), layerName);
                                  d.putReference(s2t('target'), r);
                                  return executeAction(s2t('delete'), d, DialogModes.NO);
                                };
                                
                                
                                PSUtils.setSmartFilterBlendMode = function(layer, blending) {
                                  var d, d2, d3, r;
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  r.putIndex(s2t('filterFX'), 1);
                                  r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
                                  r.putName(s2t('layer'), layer.name);
                                  d.putReference(s2t('target'), r);
                                  d2 = new ActionDescriptor();
                                  d3 = new ActionDescriptor();
                                  d3.putUnitDouble(s2t('opacity'), s2t('percentUnit'), 100.000000);
                                  d3.putEnumerated(s2t('mode'), s2t('blendMode'), PSUtils.getBlendMode(blending));
                                  d2.putObject(s2t('blendOptions'), s2t('blendOptions'), d3);
                                  d.putObject(s2t('filterFX'), s2t('filterFX'), d2);
                                  return executeAction(c2t('setd'), d, DialogModes.NO);
                                };
                                
                                
                                var createCurvesAdjLayer = function(layerNameString, blendingMode) {
                                  var d, d2, d3, r;
                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  r.putClass(s2t('adjustmentLayer'));
                                  d.putReference(s2t('target'), r);
                                  d2 = new ActionDescriptor();
                                  d2.putString(s2t('name'), layerNameString);
                                  d2.putEnumerated(s2t('mode'), s2t('blendMode'), PSUtils.getBlendMode(blendingMode));
                                  d3 = new ActionDescriptor();
                                  d3.putEnumerated(s2t('presetKind'), s2t('presetKindType'), s2t('presetKindDefault'));
                                  d2.putObject(s2t('type'), s2t('curves'), d3);
                                  d.putObject(s2t('using'), s2t('adjustmentLayer'), d2);
                                  executeAction(s2t('make'), d, DialogModes.NO);
                                  return app.activeDocument.activeLayer;
                                };
                                
                                
                                // Actual script ===============
                                
                                
                                // Generated by CoffeeScript 1.3.3
                                var USMDark, base1, curve, darkSet, doc, invertLayer, lay;
                                
                                
                                doc = app.activeDocument;
                                lay = doc.activeLayer;
                                darkSet = doc.layerSets.add();
                                darkSet.name = "Dark Halos";
                                darkSet.blendMode = BlendMode.LINEARBURN;
                                base1 = lay.duplicate(darkSet);
                                base1.name = "base";
                                curve = createCurvesAdjLayer("subtract", "Subtraction");
                                
                                
                                if (PSUtils.hasLayerMask(curve)) {
                                  PSUtils.deleteLayerMask(curve);
                                }
                                
                                
                                USMDark = PSUtils.makeSO(base1.duplicate(darkSet));
                                USMDark.applyUnSharpMask(500, 10, 0);
                                PSUtils.setSmartFilterBlendMode(USMDark, "Luminosity");
                                PSUtils.deleteSmartFilterMask(USMDark);
                                USMDark.blendMode = BlendMode.DARKEN;
                                USMDark.name = "USM - Darken";
                                PSUtils.clipLayer();
                                

                                 

                                I've tested this on 2 different Mac (PS CS6 and PS CS5) - after the error has been fired, no any other script can create ActionDescriptor() and ActionReference() objects anymore, no way. WTF?!

                                 

                                Me, I'm quite in desespair.

                                Cheers

                                 

                                Davide

                                • 13. Re: ESTK random error at ActionManager code
                                  DBarranca Community Member

                                  Got it, finally.

                                  The following function was buggy:

                                   

                                  PSUtils.clipLayer = function() {
                                    var d, r;
                                    d = ActionDescriptor;  // here lies the typo
                                    r = ActionReference;   // and there too
                                    r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
                                    d.putReference(s2t('target'), r);
                                    executeAction(s2t('groupEvent'), d, DialogModes.NO);
                                    return void 0;
                                  };
                                  

                                   

                                  For reasons that I can't get (do you have any hint?), at the first run the script completes without errors anyway, and the output is as expected. How come?!

                                   

                                  The second run it hangs, not in the buggy lines (easy peasy), but within another innocent function where the correct

                                   

                                  d = new ActionDescriptor();
                                  r = new ActionReference();
                                  

                                   

                                  are declared.

                                  Thanks to everyone who's stepped in helping with suggestions

                                   

                                  Davide (who tomorrow morning will be on his way to a long - very much needed - holidays weekend un in the mountains far from any electronic device with a display on it)