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

AM-code executes dreadfully slow

Engaged ,
Nov 11, 2016 Nov 11, 2016

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
1.2K
Translate
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

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

Translate
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
Engaged ,
Nov 11, 2016 Nov 11, 2016

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

Translate
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

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

Translate
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
Engaged ,
Nov 12, 2016 Nov 12, 2016

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'

Translate
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

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

Translate
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
Engaged ,
Nov 12, 2016 Nov 12, 2016

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

Translate
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
Engaged ,
Nov 12, 2016 Nov 12, 2016
LATEST

Ah, I got it. Sorry for spam!

Translate
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