• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

AM-code executes dreadfully slow

Contributor ,
Nov 11, 2016 Nov 11, 2016

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

TOPICS
Actions and scripting

Views

810

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Advocate ,
Nov 11, 2016 Nov 11, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 11, 2016 Nov 11, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 12, 2016 Nov 12, 2016

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"));

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 12, 2016 Nov 12, 2016

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'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 12, 2016 Nov 12, 2016

Copy link to clipboard

Copied

Try the one that should work first if not you have to experiment with other values.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 12, 2016 Nov 12, 2016

Copy link to clipboard

Copied

I'm sorry I don't think I understood. The one that should work...?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 12, 2016 Nov 12, 2016

Copy link to clipboard

Copied

LATEST

Ah, I got it. Sorry for spam!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines