3 Replies Latest reply on Sep 18, 2014 5:33 AM by A. Patterson

    Text modification notifier?

    TheDollarBill Level 1

      As near as I can tell, the only way to see when a user modified the text in a text frame is to listen for the kAIArtPropertiesChangedNotifier. Is this true? Will the notifier send any useful data that I can decode to tell what kind of art object sent it, or what specifically caused the notification? Is that level of detail reserved for callers and selectors? If so, are there any caller/selector combos that could help me?

        • 1. Re: Text modification notifier?
          A. Patterson Level 4

          The only notification you get for anything on the artboard is kAIArtPropertiesChangedNotifier, to my constant frustration. I lobbied Adobe for years to give us something more useful but in the end gave up. That kind of information would be incredibly useful and unlock the potential to do all sort of complex and intensive operations properly narrowed.

           

          Your best bet is to keep a list of ArtUIDs for art you're interested in, and come up with super fast methods for determining if they've changed. I'm afraid there's nothing to help in the SDK for this, unfortunately.

          • 2. Re: Text modification notifier?
            TheDollarBill Level 1

            Whoa! Cool!

            I've mostly dealt with processing of files (exporting, etc.) at this point.  I'm a little N00by-Doo when it comes to dealing with the artboard.  This ArtUID thing is great!  It looks like I can SET the artUID as well.  So I could have a list of art objects with ArtUID's set to whatever I want so as to monitor specific text frames?

             

            I suppose my main issue is, how can I keep this list of self-named text frames associated with the document?  Is that what "dictionaries" are for?!  I noticed your reference to GetDocumentMetaData() in another thread and I couldn't believe I missed that before.  I've been dealing with GetDocumentXAP() to get the XMP information and then parsing it myself. Do you know how GetDocumentMetaData differs from GetDocumentXAP?

             

            And I suppose I could even make a little UI allowing the user to name the text frames?  Sort of like the variables/data-sets tool, but more specific to my needs?  Do you think it would be better to try and hack into the variables/data-sets stuff to keep track of my doc-specific list of text frames or to do it myself?

             

            Sorry for all the questions. I feel like Arabian royalty falling in love with a commoner on a magic carpet ride... "It's a whole new world."  And I haven't even begun to delve into the new HTML5/JS interface stuff which makes me wonder if I should just try to script the whole thing and scrap the SDK all together????

            • 3. Re: Text modification notifier?
              A. Patterson Level 4

              Don't use the document metadata unless you really need to -- and you'll know if you need to We used to use that to store a bunch of stuff for our plugin and eventually switched whole-hog to the document dictionary because if there was any kind of problem during save, Illustrator would sometimes just truncate the metadata and not indicate that it had done so in any way. So be warned! XMP is universal data and you probably know more about that then me -- document metadata is just a place you can stick things in an XML-like way, but if you're looking to store things about the document long term, its a terrible way to do it.

               

              Dictionary are just what they sound like, a key-value pairing system. You can also have dictionaries as values, which means the possibilities are pretty endless in terms of what you can store. There are also various benefits to the way they store certain values. For example, if you have an AIArtHandle, storing that somewhere is more or less useless, as the art object it refers to will almost certainly have a different handle when you re-load the document. If you store an ArtUID in a dictionary though, it persists, and you can still find that art handle later. This is incredibly helpful!

               

              Every art object has its own dictionary (accessed through AIArtSuite::GetDictionary) and the document has one too (AIDocumentSuite::GetDictionary). Obviously the latter is more for document-level stuff and the art object one for art-object level information. The document even has a couple of funny dictionaries, like one that doesn't cause Undo or the modified flag to get set (but I believe isn't saved) for volatile, temporary stuff.

               

              ArtUIDs do have a small catch, however: adding one obviously changes the object, which in turn means the document is modified. This sounds obvious, but there are plenty of times I wish every object came pre-ID'd. It would make some things much easier! Still, if you're creating object you want to track, this is obviously no big deal since you're modifying the artboard anyways.

               

              Adding a name to text frames should be very easy. You could track all your named art via the document dictionary (probably more appropriate if you're going to have a persistent global list) or on the art object itself (if you're going to show the name only when its selected). It depends on what your users need.

               

              If you're doing something simple, the HTML5/JS stuff is probably fine. Anything beyond that and you're better off sticking in something 3rd party. We use Qt, but HotDoorCore might be a good choice -- I think it has some UI stuff in there.