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

Trying to reference a custom ActionDescriptor

Engaged ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

I'm trying to create a global action descriptor that I can read from my C++ plugin in my photoshop application:

    //.net creation of the actionDesc

    app.DoJavascript("var desc = new ActionDescriptor(); desc.putString( 0 , app.activeDocument.name); app.putCustomOptions('Glob', desc, true);");

I'm trying to get this descriptor in my plugin and I don't know if it's possible, is it possible to get a action descriptor by name in js, or is there a way in js I can return that 'desc' action descriptor?

TOPICS
Actions and scripting

Views

1.0K

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

correct answers 1 Correct answer

Guide , Aug 02, 2017 Aug 02, 2017

dynamic app = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));

To set :-

dynamic desc = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"))

            desc.PutString(0, "Fred");

            app.PutCustomOptions("UniqueName", desc, false); //Note false = this session only True will retain over all sessions.

To get :-

dynamic desc2 = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"));

            desc2 = app.GetCustomOption

...

Votes

Translate

Translate
Adobe
Guide ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

dynamic app = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));

To set :-

dynamic desc = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"))

            desc.PutString(0, "Fred");

            app.PutCustomOptions("UniqueName", desc, false); //Note false = this session only True will retain over all sessions.

To get :-

dynamic desc2 = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ActionDescriptor"));

            desc2 = app.GetCustomOptions("UniqueName");

            MessageBox.Show((desc2.GetString(0)));

Hope this helps.

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
Engaged ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

A follow up Merlin, is it possible to get the current count of the string keys in the descriptor?

I need to know what documents contain a file that was exported from an external app, so I would like to have multiple keys in the ActionDescriptor. Something like:

desc.PutString(0, "imageA");

desc.PutString(1, "imageB");

//Changed to~

desc.PutString(GetDescriptorKey(), "imageA") // count0

desc.PutString(GetDescriptorKey(), "imageB") // count1

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

LATEST

Yes...

int count = desc.Count;

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