2 Replies Latest reply on Apr 1, 2013 10:17 AM by panduvittala

    AIUID save in dictionary


      AIUIDRef uidref=GetUID(GetArt(range));


      if(dictRef)      {

           AIEntryRef entryref=sAIEntry->FromUID(uidref);

           AIDictKey dictkey = sAIDictionary->Key("mykey");

           sAIDictionary->Set(dictRef, dictkey, entryref);




      This is the code I am using to save the uid in dictionary. The code executes. Not sure if it saves uid or not. But illustrator crashes when document is closed. Any idea what is wrong?  Thanks in advance.

        • 1. Re: AIUID save in dictionary
          A. Patterson Level 4

          I think you're missing a step, here's what I'm doing:


          SetArtUIDValue(AIDIctionaryRef dictionary, const char* entryName, AIUIDRef uid)


               AIEntryRef entry = 0;


               try {

                    AIUIDREFRef uidRef = 0;

                    AIErr error = sUID->NewUIDREF(uid, &uidRef);

                    if (kNoErr != error) throw ai::Error(error);


                    AIEntry entry = sEntry->FromUIDREF(uidRef);

                    AIDictKey key = sDictionary->Key(entryName);


                    error = sDictionary->Set(dictionary, key, entry);

                    if (kNoErr != error) throw ai::Error(error);

               } catch (...) {

                    if (entry) {






               sEntry->Release(entry); // never forget to do this or you leak memory!


          • 2. Re: AIUID save in dictionary
            panduvittala Level 1

            Thanks, that worked.