Copy link to clipboard
Copied
Dear everyone,
I have one user, on his machine (Windows10 on a i5 skylake Lenovo Thinkpad Yoga + PS CC14) AM code executes awfully slow.
For example, this takes 0.04s on my old machine and 20s on his
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var appDesc = executeActionGet(ref);
Does anyone know what could be the reason?
Thanks,
Sergey
Copy link to clipboard
Copied
Might depend on the number of Fonts he has installed, or stuff like that.
As a rule (and when possible! which is not always the case) prepend the app descriptor get with the prop you're interested into, so that you're retrieving that only, e.g.
// DO
var ref = new ActionReference ();
ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("interpolationMethod"));
ref.putEnumerated (stringIDToTypeID ("application"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var interpolationDesc = executeActionGet (ref);
var theInterpolationMethod = typeIDToStringID (interpolationDesc.getEnumerationValue (stringIDToTypeID ("interpolationMethod")));
alert (theInterpolationMethod);
// DON'T
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theInterpolationMethod = typeIDToStringID(applicationDesc.getEnumerationValue(stringIDToTypeID('interpolationMethod')));
alert (theInterpolationMethod);
Hope this helps!
Davide
Copy link to clipboard
Copied
Thanks Davide!
I need to get an object
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var appDesc = executeActionGet(ref);
var curToolOpt = appDesc.getObjectValue(stringIDToTypeID('currentToolOptions'));
And If I understand correctly, I can't make this faster than getting the whole 'capp' thing
Copy link to clipboard
Copied
In this case you need to use "tool" to get "currentToolOptions"
var ref = new ActionReference();
ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("tool"));
ref.putEnumerated (stringIDToTypeID ("application"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var appDesc = executeActionGet(ref).getObjectValue(stringIDToTypeID("currentToolOptions"));
Copy link to clipboard
Copied
Thanks, SuperMerlin, exactly what I need!
May I ask you, how can I find certain property stringID? Like with tool in this example? Because I have some other objects I'm getting from 'capp'
Copy link to clipboard
Copied
Try the one that should work first if not you have to experiment with other values.
Copy link to clipboard
Copied
I'm sorry I don't think I understood. The one that should work...?
Copy link to clipboard
Copied
Ah, I got it. Sorry for spam!