Copy link to clipboard
Copied
Hi All,
I am looking for any info on scripting the Variable width tool (Javascript).
Background:
By adding a gradient to a variable width strock you can create nice 3D looking Shapes (see example)
this is a straight vertical line with varied widths, then hit with a gradient.
Goal:
My hope is to write a script that will take a "Profile" or "Shape" and convert it to a Variable width line. (see Example)
The Black line is to have its widths modified
The Red line is how wide the line needs to be.
Hope all that makes sense...
And thanks in advance peoples.
Tristan O'Brien
QwertyflyDesign
Copy link to clipboard
Copied
Illustrator scripting is very very very limited, you can't script half its features...I don't have CS6 to test, but if you can accomplish that via Actions, that might be an option...since it's been reported CS6 can play Actions.
it's also been reported that CS6 can run menu commands, so there's your options...not much help with tools I guess.
oh, the other thing it may help is you can apply graphic styles...but that's as far as you can go with it, you have to create them by hand.
Copy link to clipboard
Copied
Ok. So I have created a new account as I can't acces the last one.
Illustrator scripting is limited. But the real limitation of it is the available documentation.
Actions are a little to basic to accomplish this task. But when you say cs6 can play actions I get confused. I think you mean running scripts from an action.
This has been possible in all iterations of CS. Only they are not persistent on restart. Same deal I think with menu commands.
My thought is the actions panel loads on program start before the scripts get loaded in the menus. But that's off topic.
I can't see how to do this with graphic styles.
I will put together a better explanation of what I am trying to achieve in the hopes that it can be done, and that it's my poor description getting in the way.
Thanks for the quick response.
Copy link to clipboard
Copied
yeah, actions calling scripts is great but they don't persist the restart...but I meant scripts playing actions, not possible in CS5 using javascript, apparently possible with CS6.
...about running menu commands, no can do before CS6, but for your request it wouldn't help I guess.
...graphic styles, I just tested it and it works, meaning you create your Width profile, save it as a graphic style (both manually), then you can apply it to any path via scripting.
Copy link to clipboard
Copied
Ok, That makes sense. I did read that you can now run actions from a script, somewhere...
As for the graphic styles, its the profile I wish to make each time.
I'll see if I can make this make sense...
If I start by drawing a line. Select it then run my script...
From here the script would take over, Drawing a line from Most Left end, and the height of the object. Then extend line to meet, and join.
So far I can see all of the above can be done (this is just an example)
Here I have used the Variable Width tool to widen to top of the red Line to the first anchor. Then move down a set amount and widen to intersection of black line. Repeat untill no more line.
This is sketchy as I did it by hand and too quickly, and it's as far as i can go on this PC as I only have CS5 here.
But in essence that is what I'm trying to achieve.
Hope that makes it a bit clearer.
Thanks.
Copy link to clipboard
Copied
that's what I'm trying to explain...it seems it is not possible to do the width profile via scripting, you'll have to do it by hand, then when you're happy with the results, drag your whole object to the Graphic Styles Palette, give it a name and only then, you'll be able to apply this very same graphic style to other paths, let say other plain lines, via scripting.
...by the way, try to access your original account...that user name is much better
Copy link to clipboard
Copied
I lost the password, Prob like the Name. And I think I used an old email as I get no Email when I ask to reset it.
I was odviously not in a good mood with adobe when I came up with that one...
What you describe with graphic styles is like making a brush.
I wonder if I could use an onMouseDown Event to trigger the tool.
I hope I don't have to resort to AHK
Copy link to clipboard
Copied
sorry to be the bearer of bad news...there's no access to events either
Copy link to clipboard
Copied
I was looking at this:
http://scriptographer.org/tutorials/interaction/mouse-tool-events/
I have not had a chance to have a look at it yet. but looks interisting...
Copy link to clipboard
Copied
oh, that's another story, yeah you might be able to do it with that.
Copy link to clipboard
Copied
I'd like to note here that there is access to events if one builds the extension panel with CS Extension Builder though. But Ilustrator events, not mouse clicks.
SelectionChanged is the particularly useful one.