Wednesday, August 08, 2007

CS3 and Script Chaining

I've been playing with the new JS engine in Illustrator CS3, and it is now possible to import script libraries. Incidentally, this also allows one to chain scripts using the following syntax:

//Customize the following line to reference a library script from your main Illustrator script directory: (note you can select multiple sources by separating with a semicolon.)

#includepath "../../../presets/scripts/myLib;../../../../presets/scripts/myLib"
#include "script1.js"
#include "script2.js"
#include "script3.js"
//put your custom code here:
alert("ta-da!!!");

I will be writing more modular scripts soon to take advantage of this.
I'm looking forward to seeing what people do with this. Now if only we can get those actions to stay linked...

2 comments:

Unknown said...

Is there a way to repeat the "last script used" by just hitting a key (without going again & again to the script menu)?


Thanks

John said...

Yes... and no. You CAN attach a script to an ACTION by selecting "Insert Menu Item" from the flyout on the actions panel. You an assign a shortcut key to that and you have your shortcut working... but only until you reboot, where Illustrator exasperatingly forgets what it was exactly that the shortcut was supposed to do. And yes, it still does this in CS3...