precede your script with
#target Illustrator #targetengine main
Thank you for a really quick answer!
Just out of interest why does this work ?
I assume that #target Illustrator is making the script be executed in illustrator. Feels like a safe bet. But please fill me in if you have some additional info.
I did a quick read on targetengine and from what I understand if I target the main the script will be executed in the main engine which is reset after a script is run so no persistence there. But I also read that this is the default engine, so why do I need to target it? Could I think of the engines as a type of namespace where the scripts are executed? or am I mixing concepts here?
Any info will be appreciated!
that's correct, #target simply tells the estk what application should run it, not really necessary if you run the script within Illustrator.
#targetengine can be seen as a namespace and it is the scope where the script runs. You can define your own engine, it could be anything...the thing with palettes is that they seem to run in the fifth dimension and are not connected to illustrator, until "declared".