Copy link to clipboard
Copied
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
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)
{
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now