Sg2.9
average color script gives sy...
Recent RSS
average color script gives syntax error
From:  Jolande
Date:  15. January 2014, 12:10

ForumI'm using this script but it gives a syntax error at Scriptographer Scriptsaverage color.js:16

var rasters = document.getItems({
type: Raster,
selected: true
});

var paths = document.getItems({
type: Path,
selected: true
});

// if the user has selected an image and at least one path
if(rasters.length > 0 && paths.length > 0) {
var raster = rasters[0];
// loop through the paths
for (var i = 0; < paths.length; i++) {
var path = paths[i];
var color = raster .getAverageColor(path);
path.fillColor = color;
}
} else {
Dialog.alert('Please select an image and at least one path');

Can someone tell me what is wrong?

Thanks in advance

Re: average color script gives syntax error
From:  pqbd
Date:  15. January 2014, 20:22

You're missing the first part of your condition of the for loop:

for (var i = 0; < paths.length; i++) {

should be:

for (var i = 0; i < paths.length; i++) {

You're also missing the closing curly brace of your last else statement.

Re: average color script gives syntax error
From:  Jolande
Date:  15. January 2014, 20:46

Thank you very much, it works!

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
Crop Marks 14.02.12
by Zed