Scripting tweak

Log-in or register.

Scripting tweak

Published by on October 30th 2013.

Since scripting in RWPaint is getting more and more popular, I have spent some time improving it today. The change is not big, but I hope you'll find it useful when it is released (probably in 2014).

So, the change affects the Operation object. This global object can be used to run operations. Today, the whole process has 3 steps:

  1. A configuration object for given operation is created.
  2. Actual values are put into the configuration object.
  3. Operation is executed on given document using the previously created configuration object.

For example, if I wanted to use the blur effect in a scripted operation, the code could look like this:

// step 1
var blur = Operation.Create("Raster Image - Blur");

// step 2
blur.Type = 3;
blur.HSize = 30;

// step 3
Operation.Execute(blur, Document);

In the above case, I am instructing the blur effect to perform horizontal blur (Type=3) and setting the blur size to 30 pixels (HSize = 30).

In the future version, the whole process will be simplified. Here is how it would look like:

Operation.Blur(Document, {Type:3, HSize:30});

The first change is the removal of the configuration object. Instead, a native JavaScript array/object is used. Second change is how the actual operation is identified. Previously, it was necessary to use the exact name of the operation (Raster Image - Blur), in the new version, the scripting sub-system will search all available operations and find the closest match for the given verb (Blur).

I believe this simplification will make it much easier to apply effects on images using scripts. Expect it in the next version or RW tools.

Recent comments

user icon jojois74 registered user on October 31st 2013

I personally feel that the main problem with the API is that there is no tutorial showcasing the main aspects of the scripting capabilities, while guiding you through the basic objects and such. The prerequisite would be a basic knowledge of (object oriented) JavaScript. I know that there is a sort of tutorial where you analyze a noise generator, but what I'm talking about is a full tutorial.

user icon Vlasta site administrator on October 31st 2013

Yes, there is no good tutorial on scripting. Explaining everything would take a lot of time and I see not good starting point. I guess I'll try to demonstrate and explain how my latest script in a video.

user icon jojois74 registered user on October 31st 2013

Ok, gotcha.

user icon Anonymous
I wish there were...
Vista & Win 7 icons
What about ICL files?
Select background