Sg2.9
Script for Symbols Illustrato...
Recent RSS
Script for Symbols Illustrator cs5
From:  Matt Pleasant
Date:  11. February 2012, 14:15

hi- I'm looking for help on a script that when ran will open up a prompt with several input and dropdown boxes, and based off of the user's selection a symbol will be chosen from the symbol library and swapped with a placeholder on the artboard. I don't have any starter code, as I'm very new to scripting. So if anyone has an idea of how I could get started with this script, it would be much appreciated.

thanks,
Matt

Re: Script for Symbols Illustrator cs5
From:  pqbd
Date:  12. February 2012, 04:58

You'll want to check out the tutorial on interface components, specifically the list component.

Creating and getting symbols is pretty easy. Any item can be made into a symbol with the new Symbol(item) constructor. All symbols that are currently in a document can be listed by calling document.symbols. You can reference them by their index in the symbols palette, or by name.

Re: Script for Symbols Illustrator cs5
From:  Matt Pleasant
Date:  12. February 2012, 14:27

Thanks alot! I will give that a shot.

Re: Script for Symbols Illustrator cs5
From:  Matt Pleasant
Date:  13. February 2012, 02:20

Thanks for the help from earlier!

I now undersand how to use the interface components and the symbol constructor as you stated above. My problem now is trying to figure out the syntax for creating an IF statement within Javascript. I'm familiar with VBA using conditionals but javascript is tripping me up. Ideally, I want to be able to select multiple options using drop down lists, and depending on the selection or combination of selections, a button is clicked to pull in a certain symbol that meets the criteria to the artboard.

Button 4 is where I would assume the IF statement would go, but I'm not sure. Most info I've found online is in reference to the web, and this doesn't really fit in that category. Any help would be greatly appreciated.

Here is what I got so far:

var components = {
button: {
type: 'list', label: 'Fill Opening',
value:'10"',
options: ['10"', '13"', '18"']
},
button2: {
type: 'list', label: 'Seam Type',
value:'Two',
options: ['Single Needle', 'Double Needle', 'Knife Edge']
},
button3: {
type: 'list', label: 'Piping',
value:'Yes',
options: ['Yes','No']
},
button4: {
type: 'button',
value:'Create Shell',
onClick: function ()
{var symbol = document.symbols['purpleBox'];
var placedSymbol = new PlacedSymbol(symbol, new Point(237, 358));

}
};

var palette = new Palette('Shell Creation', components);

thanks,
Matt

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Shape Contours V2 26.04.12