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

Call a user action from a plugin

Explorer ,
Oct 11, 2011 Oct 11, 2011

Hello

Is it possible to call an action made by a user, if yes how I can retrieve it (by its name ?) and is it possible to set some arguments of the action ?

Thanks

TOPICS
SDK
1.3K
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

correct answers 1 Correct answer

Enthusiast , Jan 03, 2012 Jan 03, 2012

here it is a sample of how PlayActionEvent method could be used:

ASErr

AIArtHandleModifier::Rasterize()

{

          AIErr result = kNoErr;

          AIActionParamValueRef valueParameterBlock = NULL;

          ActionDialogStatus dialogStatus = kDialogOff

  try

          {

                    result = sAIActionManager->AINewActionParamValue(&valueParameterBlock);

                    aisdk::check_ai_error(result);

                    if (valueParameterBlock)

                    {

                          

...
Translate
Adobe
Guide ,
Oct 12, 2011 Oct 12, 2011

I think its possible. You'd do it with AIActionManager::PlayActionEvent() (AIActionManager.h). It takes a AIActionParamValueRef which is made up of parameters, so yes, you can set parameters. I'm not sure how you figure out the name exactly though. Its probably whatever you name it when you record it, but I'm not sure if that's enough for the system to find it? Hopefully, but I've never tried so I don't know the details exactly. I've used it to run built-in Adobe actions though and I know that works just fine.

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
Enthusiast ,
Jan 03, 2012 Jan 03, 2012

here it is a sample of how PlayActionEvent method could be used:

ASErr

AIArtHandleModifier::Rasterize()

{

          AIErr result = kNoErr;

          AIActionParamValueRef valueParameterBlock = NULL;

          ActionDialogStatus dialogStatus = kDialogOff

  try

          {

                    result = sAIActionManager->AINewActionParamValue(&valueParameterBlock);

                    aisdk::check_ai_error(result);

                    if (valueParameterBlock)

                    {

                              //set valueParameterBlock values (params) before calling

                              //PlayActionEvent method.

                              //It's up to you to set it

                              result = sAIActionManager->PlayActionEvent("ai_plugin_rasterize", dialogStatus, valueParameterBlock);

                              aisdk::check_ai_error(result);

                              result = sAIActionManager->AIDeleteActionParamValue(valueParameterBlock);

                              aisdk::check_ai_error(result);

                    }

               }

          catch(ai::Error& ex)

          {

           //Do something with this!!!

          }

  return result;

}

Regards,

Thomas.

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
Explorer ,
Jan 03, 2012 Jan 03, 2012

Thanks.

I succeeded to use the ai_plugin_rasterize.

I exported the action to see how to get the names and the values for the different parameters.

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 ,
Dec 14, 2022 Dec 14, 2022
LATEST

I would like to do something similar, to play back a top-level action as recorded by the user, e.g., the Default Actions' "Rasterize (Selection)" which contains "ai_plugin_rasterize" and could be modified to contain other action items from other plugins as well. Another example is the "Delete Unused Panel Items" user action which contains multiple individual plugin actions. I will know in advance the name of the action I want to play, and wish to exit gracefully if an action by that name does not exist.

 

My dilemna is that user actions can play user scripts, user scripts can play user actions, but I want to play one or the other directly from my plugin. I suspect this simply is not possible, but must ask before giving up. -- Thanks

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