Problem creating/accesing a document dictionary
I have problems creating and accessing a document dictionary.
I create a new docuemnt using the NEW item in the Illustrator menu.
Then I execute the following code through my plugin. I does not work. That is I a unable to retrieve any value fro the dictionary . Actually I am not even sure I wrote anything in the dictionary.
Is there anything wrong in my code ?
thanks.
{
AIDictionaryRef dictionary =NULL ;
AIErr error = 0;
error= sAIDocument->GetDictionary ( &dictionary );
AIDictKey KEY = sAIDictionary->Key( "MY_Key" );
string mykey= "2";
error = 0;
error= sAIDictionary->SetStringEntry ( dictionary, KEY , mykey.c_str());
AIErr error = 0;
error= sAIDocument->GetDictionary ( &dictionary );
const char* Namevalue ;
error = sAIDictionary->GetStringEntry(dictionary, KEY, &Namevalue);
sAIDictionary->Release (dictionary);
}