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

[CS2]How to playback an action from the actions palette?

New Here ,
Mar 26, 2009 Mar 26, 2009
Hi all,

I want to play back an action(already recorded) from the actions palette using the SDK.

How can i tell compiler the name of the action that it should play back for me from the actions palette?

Can any one provide me the code snippets to do this?That will be very helpful.

Thanks in advance.

Regards
myRiaz
TOPICS
SDK
1.5K
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
Guide ,
Mar 26, 2009 Mar 26, 2009
This is purely speculative, but if you save your action set as a .aia file, you can open it in a text editor. I notice there's a line that looks like:

/name [ 31
4170706c792044656661756c74205374796c65202873656c656374696f6e29
]

I'm not sure if this will work with PlayAction, but I'm guessing that string of numbers is actually the encoded name as 2-digit char values. E.g. the first character is 0x41 or 'A'. I'm pretty sure that should match up with the name listed in the Action palette though, so maybe you've tried that & it didn't work.

Failing that, you probably will just have to hunt through that text output and try your hand at whatever you find in there. I can't even say with absolute certainty that you *can* play any old action via PlayAction, though that would seem logical. The documentation implies you can only use names that have been used with RegisterAction, so maybe you can't play sets you've personally recorded -- I just don't know.
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
New Here ,
Mar 26, 2009 Mar 26, 2009
Thanks for ur reply Patterson.
I already went thru this forum searching for this kind of topic & also found so many threads which was answered by you about actions.
In those threads you have specified to get data from the text file of the recorded action.

That was really great idea & wen i looked into that txt file i had a lot of hope that im on the right track.

I also tried with the various parameters that the txt showed me.
But im struck in what parameter should i pass in the value parameter block i.e here i mean to pass the name of the action that i want my code play back for me.But should to code this?!!!!

I also went thru the Sample Project "Tutorial" that come with the SDK which does some thing with actions like RegisterActionEvent,Recording an action etc.

But i could not still figure out how to play an already recorded action from the actions palette.

It would be very helpful for me if i get any code snippets from developers like u.

My actual target is to run a javascript from my plugin code.Since there is no direct option in SDK for doing this so i recorded an action which plays my Javascript & now im trying to make this action to be played back from my plugin code.Hope my target is clear for u.

Thanks
myRiaz
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 ,
Apr 27, 2009 Apr 27, 2009

this is how i used to do:

    AIErr result = kNoErr;
    AIActionParamValueRef valueParameterBlock = NULL;
    ActionDialogStatus dialogStatus = kDialogOff;

    try
    {
        result = sAIActionManager->AINewActionParamValue(&valueParameterBlock);
        aisdk::check_ai_error(result);  

        if (valueParameterBlock)
        {           
            result = sAIActionManager->AIActionSetString(valueParameterBlock, kAIExportDocumentFormatKey, "param");
            aisdk::check_ai_error(result);  

            result = sAIActionManager->AIActionSetString(valueParameterBlock, kAIExportDocumentExtensionKey, "param");   
            aisdk::check_ai_error(result);  

            result = sAIActionManager->AIActionSetString(valueParameterBlock, kAIExportDocumentNameKey, "param");
            aisdk::check_ai_error(result);  

            result = sAIActionManager->PlayActionEvent(kAIExportDocumentAction, dialogStatus, valueParameterBlock);   
            aisdk::check_ai_error(result);  

            result = sAIActionManager->AIDeleteActionParamValue(valueParameterBlock);
            aisdk::check_ai_error(result);   
        }    
    }
    catch(ai::Error& ex)
    {
        result = ex;
    }
    return result;

ps: param is the value!

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
New Here ,
Apr 29, 2009 Apr 29, 2009

Hi,

     Im new to the illustrator.  I want to play the action from sdk which already recorded.  When searching, got ur code snippet.  When i use tat it says some error for aisdk::check_ai_error(result);    ....

error C2653: 'aisdk' : is not a class or namespace name
error C3861: 'check_ai_error': identifier not found, even with argument-dependent lookup

     Can understood aisdk::check_ai_error(result) is for exception... But it says some error... Have to add any header file or namespace for this?...

     Then i don't know which type of value have to pass for exportDocument... Pls could u explain about tat and can give code with values (param) for tat?

     Thanks in advance.

        Sudha

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 ,
Apr 29, 2009 Apr 29, 2009
LATEST

aisdk is a namespace declares in a header file from the sdk. You could find it here:

\Adobe_Illustrator_CS3_SDK\samplecode\SnippetRunner\Source\SDKErrors.h

this throws exception if the given error code is non zero. Only for exceptions handling.

You could implement our own method for error handling. If error code is non-zero, do somthing.

But if you want to use this header anyway, you just have to include it.

First of all, you must retrieve all parameters from your recorded action.

Just take a look at aiactiomanager.h for setting correctly params for methods you will use.

Thomas

ps: http://forums.adobe.com/thread/423942?tstart=0 for retrieving action params, type and value.

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 ,
Mar 31, 2009 Mar 31, 2009
Unfortunately, I don't have any snippets because I've never had to do this 😛 That said, I'd guess the name should just be the name, not encoded. There are a few headers if you dig deep enough (in the Actions folder) that have a whole bunch of constants that might be helpful.

It feels like this should be possible, but I'm afraid I'm just speculating, having never actually done this.
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