Copy link to clipboard
Copied
Hi,
I want to call action from illustrator sdk. I recorded one action for drawing polygon and called from sdk but its not working correctly. I think i did not pass parameters correctly. But i dont know how to pass parameter for tat action call. When i see action it show 4 parameter center X, center Y, radius, sides but when i saved that action it shows 8 parameter count. I dont know how many parameters have to pass? And how to pass tat? If anyone knows pls let me know...
Thanks in advance.
Copy link to clipboard
Copied
Are you trying to call the action you recorded? Or are you trying to call an action for one of the operations your recorded action used? If its the former, you should be able to just specify the name I believe, and you should get whatever parameters you recorded.
If you're trying to invoke an action for a specific Illustrator operation, yes, you'll need to know the parameters & specify them properly.
Copy link to clipboard
Copied
Hi,
Im new to the illustrator... So i dont know how to find that parameters.. It varries from action palette and action file (like default.aia) when we open and see tat file. How do i know which one is correct no.of parameters and how to pass tat to call tat action we recorded...
Some of the built-in actions in the header files(AIDocumentAction.h) have internal name of the action(adobe_closeDocument) and parameters also (all, save like tat)... But the action file which i recorded contains like tat...
Swatchdeletion.aia
/version 2 | ||||
/name [ 4 | ||||
73776174 | ||||
] | ||||
/isOpen 1 | ||||
/actionCount 1 | ||||
/action-1 { | ||||
/name [ 3 | ||||
73726d | ||||
] | ||||
/keyIndex 0 | ||||
/colorIndex 0 | ||||
/isOpen 1 | ||||
/eventCount 1 | ||||
/event-1 { | ||||
/internalName (ai_plugin_swatches) | ||||
/localizedName [ 8 | ||||
5.37762E+15 | ||||
] | ||||
/isOpen 0 | ||||
/isOn 1 | ||||
/hasDialog 1 | ||||
/showDialog 1 | ||||
/parameterCount 1 | ||||
/parameter-1 { | ||||
/key 1835363957 | ||||
/showInPalette -1 | ||||
/type (enumerated) | ||||
/name [ 13 | ||||
44656c65746520537761746368 | ||||
] | ||||
/value 3 | ||||
} | ||||
} | ||||
} | ||||
This is swatch deletion recorded by manually.. When i calling its not working correctly.. i think i have to pass swatch name or index to tat... but dont know how? Pls tell me how to find that parameters and calling tat?
Thanks in advance.
Copy link to clipboard
Copied
reeading your .aia, you have got only one parameter to set, which is type of enumerated.
you could try to do as follow:
AIErr result = kNoErr;
AIActionParamValueRef valueParameterBlock = NULL;
ActionDialogStatus dialogStatus = kDialogOff;try
{
result = sAIActionManager->AINewActionParamValue(&valueParameterBlock);
aisdk::check_ai_error(result);if (valueParameterBlock)
{
result = sAIActionManager->AIActionSetEnumerated(valueParameterBlock, "yourkey", "your key value"));aisdk::check_ai_error(result);
}
}
catch(ai::Error& ex)
{
result = ex;
}You could use this site to convert your key from int to a readable format!
http://www.vortex.prodigynet.co.uk/misc/ascii_conv.html
then only call the command correclty!
thomas.
Copy link to clipboard
Copied
Hi,
When i use tat code it says some error for this line
aisdk::check_ai_error(result);
Have to add any header file or namespace to tat?....
sAIActionManager->AIActionSetEnumerated(valueParameterBlock, "yourkey", "your key value"); But It contains 4 parameters
ASErr ASAPI (*AIActionSetEnumerated)(AIActionParamValueRef param, ActionParamKeyID key, const char* name, ASInt32 value); What is ASInt32 value? I couldn't able to open the site which u gave also....
My Code is here...
AIErr result = kNoErr;
AIActionParamValueRef valueParameterBlock = NULL;
ActionDialogStatus dialogStatus = kDialogOff;
try
{
result = sAIActionManager->AINewActionParamValue(&valueParameterBlock);
//aisdk::check_ai_error(result);
if (valueParameterBlock)
{
result = sAIActionManager->AIActionSetEnumerated(valueParameterBlock, 'indx', "Smoke",13);
//aisdk::check_ai_error(result);
}
}
catch(ai::Error& ex)
{
result = ex;
}
MessageBox(NULL,"Bef action","",0);
result = sAIActionManager->PlayActionEvent("ai_plugin_swatches", dialogStatus, valueParameterBlock);
result = sAIActionManager->AIDeleteActionParamValue(valueParameterBlock);
MessageBox(NULL,"Aft action","",0);
It displays messagebox before and after playaction but not working operation of tat corresponding action (delete swatch). I think i did mistake in
result = sAIActionManager->AIActionSetEnumerated(valueParameterBlock, 'indx', "Smoke",13); Pls tell me is it correct or not?
Thanks in advance.
Sudha
Copy link to clipboard
Copied
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.
Just take a look at aiactiomanager.h for setting correctly params for methods you will use.
Sorry for telling you mistakes! I have not checked method before telling you how to do.
Copy link to clipboard
Copied
Thank you... I passed parameters to tat but still its not working... Does not say any error and comes to the end of the code but the operation swatch deletion is not done...
When i calling action without parameter, it says "the object is not available"... I dont the reason for this....
Copy link to clipboard
Copied
Unfortunately, the site http://www.vortex.prodigynet.co.uk/misc/ascii_conv.html is no longer there. I found another site, though: https://onlinetimetools.com
Now if I can find the method to turn an integer like 1818455661 into four chars...