If you need ActionScript code run right away, you'll need to set the extension to start on applicationActivate (or something like it).
That means you'll probably need two extensions -- the visible one, and another invisible one...
Yes, exactly. I have a visible extension that acts as the UI. I have another extension that could remain invisible until my Illustrator-SDK plug-in calls it. The problem is that the "PostStartup" notifier seems to happen too early to allow the extension to be loaded.
Also, I just realized... should I have posted this in the extension builder forum?
Instead of having the C++ call the extension, can you have it work the other way around?
I don't think so. It has to bring up the extension in the middle of some of the C++ stuff. I suppose I viable load time would be upon a save event...
But then would I have to unload it every time? I mean do I have to check to make sure it's not already loaded if the user saved, and then saved again?
Ah, this is a known issue. For CS5 the workaround I used was to start an AI Timer in my plug-in's startup code which went off after '1 tick' (AI SDK terminology, IIRC). After 1 tick, PlugPlug has started up and is available to use.
In the next version of AI SDK I believe there will be a 'PlugPlug set up' notifier which removes the need for the timer workaround.
Yes! Thanks David! And thanks Harbs.
The AITimer totally works, however, now I am still wondering when I need to load and unload extensions so that everything is "happy". Is it unsafe to call LoadExtension and then call it agian before UnloadExtension is called?
Thanks again, y'all.