Sg2.9
Poll: Changes to Art.style
Recent RSS
Poll: Changes to Art.style
From:  Jürg Lehni
Date:  27. March 2007, 06:04

The way Art.style is currently implemented is a thron in my side since a long while. I do not like the excessive nesting, e.g.

path.style.stroke.width = ...

The reason why I have implemented it that way was to give the possibility to copy only the stroke style from one object to the other, or only the fill style. But probably this is not used so often, and it could easily be offered through two functions?

I am currently considering making it more like the style property in CSS, so only with one hierarchy of objects bellow style:

art.style.fill.color -> art.style.fillColor
art.style.stroke.width -> art.style.strokeWidth

And while at it, we could also consider getting rid of style completely, e.g. art.fillColor, etc.

Also, I am not happy with the overlapp of characterStyle and style in all TextFrame based objects, and with the naming characterStyle in TextRange, that could as well just be called style.

But before I change anything, I wanted to hear the your opinions on this here.

Re: Poll: Changes to Art.style
Date:  27. March 2007, 08:48

I haven't ever needed to only copy style.stroke or style.fill from an item - so I'm +1 on art.style.fillColor and art.style.strokeWidth..

I don't like art.fillColor because I would probably miss the ability to create a style and reuse it..

Re: Poll: Changes to Art.style
From:  Jürg Lehni
Date:  27. March 2007, 13:24

Yes, Director also does not use the style object. But I agree with Jonathan about the usefullness of being able to set style objects in one go.

And here's an idea: How about making style also accept plain JS objects:

art.style = {
    strokeColor: new RGBColor(1, 0, 0),
    strokeWidth: 1
}

My observation about characterStyle and style is probably wrong: There is also paragraphStyle, and both fields on the TextFrame are nothing else than a redirect to TextFrame.range.characterStyle / paragraphStyle. So I guess this is allright and should stay that way.

The question with all this is:

Shall I change that for 2.0.023, or wait? This will be the release for CS3, so maybe I should stick with the old way for a little longer? People would have to update their scripts, which might cause a lot of confusion....

Re: Poll: Changes to Art.style
Date:  27. March 2007, 13:57

Oooh I like the idea of having style accept JS objects! +1 on that one for sure.

Personally, I'm okay with changing it for 2.0.023 - but I wonder if it would be possible to implement a mechanism whereby we could beta test the new versions before they are released on Scriptographer.com..

This would give us some time to update our scripts and make sure Scriptographer is working correctly.

Also, if a new version of Scripto breaks scripts that are currently on Scriptographer.com, shouldn't they be disabled until the authors have updated them? It's a bit of crappy experience if people download Scriptographer only to find out that half of the scripts don't work..

Talking about versions, I would like to be able to perform a version check when people initialize a tool, to make sure people aren't using outdated versions of Scripto.

Re: Poll: Changes to Art.style
From:  Jürg Lehni
Date:  27. March 2007, 14:18

Yes yes yes, indeed.

All that is badly needed, but also a whole lot of work.

Already, producing just one new release and checking on versions and systems takes a long time. Now if I did that with the current version and the upcoming beta version (while the current one is already beta), I would have so much administrative work to do, I could no do new work on Scriptographer. Also, I would have to maintain branches, be able to build both (on both PC and Mac). I think that would simply be too much.

Giving access to the Scriptographer and Illustrator version is long overdue. Instead of making this a global variable that people will have to check against in each script, I had a better idea: I propably will define a special keyword that can be used in comments, and that the script file is checked against and an error is raisen if the version is not met.

E.g. something like:

// @ver: SG2.0.023+ IL11.0+

I will also expose the current versions as variables, but not sure yet where...

Probably there will be a global object, e.g. scripto, or sg, and this object will offer some values (sg.scriptDir, sg.version, etc.). There will also be the global "app", and the illustrator version can be read from app.version.

Not sure about the naming yet. Any propositions?

Re: Poll: Changes to Art.style
Date:  28. March 2007, 11:38

sg sounds good enough to me..

And I understand that doing beta releases for developers is a bit too much to propose.. Sometimes my mind is in the perfect world, and not the real one ; )

Re: Poll: Changes to Art.style
From:  Jürg Lehni
Date:  28. March 2007, 13:19

Well, I could hold back future releases (e.g. 2.0.024) and offer them on a special download page until people think it works well, and then swap on the main download page. That should be easy enough, and also cover most of the cases we had problems with.

Re: Poll: Changes to Art.style
From:  Jürg Lehni
Date:  27. April 2007, 03:01

More changes coming down the road for 2.0.024:

I moved activeDocument to app.activeDoument, documents to app.documents and fonts to app.fonts.

There is the script object that currently offers script.file (guess what), and script.preferences, which is a container for storing per script preferences:

script.preferences.key = value;

There is now app.version, which represents the Illustrator version.
And I am thinking about app.scriptVersion, representing the Scriptographer build number (e.g. 024, but as an integer, so 24), which should be enough to identify versions for a long time. The alternative would be scriptographer.version (e.g. 2.0) and scriptographer.build.The app object exposes all kinds of other things, which will appear in the Reference once I put it online.

I also want to decide about the other renaming changes that we had a poll about a while ago, so all changes can be taken care of at once, in every single script. I will help with that process...

Any thoughts?

Re: Poll: Changes to Art.style
From:  Jürg Lehni
Date:  27. April 2007, 13:10

I tend to think so too. And it would allow to separate things more logically, e.g. there would be scriptographer.scriptDirectory, which would be the root of all scripts (not evil), scriptographer.pluginDirectory, etc. Not sure if that's ever going to be used, but I get the feeling yes.

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
Lorem Ipsum Generator 25.06.11