hi, i have this little snippet that used to run almost instantly under CS6, but now takes up to 10 seconds in CC2014. still runs, just very very slowly. any idea why or how to fix? the code gets you the string value of the current tool, maybe someone has an alternative way of doing it? thanks
Code: Select allvar ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID( "Ordn" ), charIDToTypeID("Trgt") );
var currentTool = typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID("tool")));
alert (currentTool);
snippet for getting name of current tool now runs super slow
snippet for getting name of current tool now runs super slow
i broke it down into steps and it seem like "executeActionGet()" is the culprit, but i really don't see a way around something so fundamental. anyone else having this issue?
Code: Select allvar ref = new ActionReference();
var idcapp = charIDToTypeID("capp");
var idOrdn = charIDToTypeID("Ordn");
var idTrgt = charIDToTypeID("Trgt");
ref.putEnumerated( idcapp, idOrdn, idTrgt);
var desc = executeActionGet(ref); //slow down
looks like i am downgrading back to CS6 for now.
Code: Select allvar ref = new ActionReference();
var idcapp = charIDToTypeID("capp");
var idOrdn = charIDToTypeID("Ordn");
var idTrgt = charIDToTypeID("Trgt");
ref.putEnumerated( idcapp, idOrdn, idTrgt);
var desc = executeActionGet(ref); //slow down
looks like i am downgrading back to CS6 for now.
snippet for getting name of current tool now runs super slow
weipai wrote:i broke it down into steps and it seem like "executeActionGet()" is the culprit, but i really don't see a way around something so fundamental. anyone else having this issue?
I guess each new version of Photoshop adds an increasing number of properties to the application object, so you'd better build an explicit reference to the specific property you want to access.
Please try this:
Code: Select allvar ref = new ActionReference();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("tool") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID( "Ordn" ), charIDToTypeID("Trgt") );
var currentTool = typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID("tool")));
alert (currentTool);
which can be rewritten that way for better readability:
Code: Select allvar ref = new ActionReference ();
ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("tool"));
ref.putEnumerated (stringIDToTypeID ("application"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var desc = executeActionGet (ref);
var currentTool = typeIDToStringID (desc.getEnumerationType (stringIDToTypeID ("tool")));
alert (currentTool);
BTW, it seems that there was the same performance problem to get the interpolation preference in this post: bb/viewtopic.php?f=9&t=5850
HTH,
--Mikaeru
I guess each new version of Photoshop adds an increasing number of properties to the application object, so you'd better build an explicit reference to the specific property you want to access.
Please try this:
Code: Select allvar ref = new ActionReference();
ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("tool") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID( "Ordn" ), charIDToTypeID("Trgt") );
var currentTool = typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID("tool")));
alert (currentTool);
which can be rewritten that way for better readability:
Code: Select allvar ref = new ActionReference ();
ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("tool"));
ref.putEnumerated (stringIDToTypeID ("application"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var desc = executeActionGet (ref);
var currentTool = typeIDToStringID (desc.getEnumerationType (stringIDToTypeID ("tool")));
alert (currentTool);
BTW, it seems that there was the same performance problem to get the interpolation preference in this post: bb/viewtopic.php?f=9&t=5850
HTH,
--Mikaeru