Preset manager

Discussion of the xtools Toolkit

Moderators: xbytor, DavideBarranca, Paul MR

myranalis

Preset manager

Post by myranalis »

In the PresetsManager.prototype.getPresetsManager I am sometimes getting a 'General Photoshop error occurred.' on the line 151:

Code: Select all3/15/10 22:23:45:    Source: (142)   
3/15/10 22:23:45:    Source: (143)      if (!self.manager) {
3/15/10 22:23:45:    Source: (144)        var classApplication = cTID('capp');
3/15/10 22:23:45:    Source: (145)        var typeOrdinal      = cTID('Ordn');
3/15/10 22:23:45:    Source: (146)        var enumTarget       = cTID('Trgt');
3/15/10 22:23:45:    Source: (147)   
3/15/10 22:23:45:    Source: (148)        var ref = new ActionReference();
3/15/10 22:23:45:    Source: (149)        ref.putEnumerated(classApplication, typeOrdinal, enumTarget);
3/15/10 22:23:45:    Source: (150)       
3/15/10 22:23:45:    Source: (151) >>     var appDesc = app.executeActionGet(ref);
3/15/10 22:23:45:    Source: (152)        self.manager = appDesc.getList(sTID('presetManager'));

I have not yet tracked down why. As far as I understand the script listener code stuff going on it is only trying to set the target to the application object at this point. Correct?

It mostly appears when running through the ESTK - but the target is set to photoshop. Any idea why or how to work around? Thx

xbytor

Preset manager

Post by xbytor »

It mostly appears when running through the ESTK - but the target is set to photoshop.

If the target wasn't set to PS, the script would have failed much earlier.
What version of PS? What platform?

Any idea why or how to work around?

That bit of code is about as clean as it gets. One thing you can try to help isolate the problem is replace

Code: Select allvar appDesc = app.executeActionGet(ref);

with
Code: Select alltry {
    var appDesc = app.executeActionGet(ref);
} catch (e) {
    $.level = 1; debugger;
}

This will stop the script when the error occurs and allow you to take a look at 'app' and poke around and see what's going on. The ESTK-PS protocol can fail in various ways at various times and this may just be one of those cases.

-X