View Full Version : strange.....


babedieboe
01-04-2005, 10:14 AM
I have CS, so does my friend.
So i made a script in JS that does loads of things.......
One of them is that i am making a selection and filling it with a color, like
beneath, BUT it works on 3 different pc's with CS, but at my friends
PC it just draws a 1x2 pixels (hxw) square, instead of filling the whole
layer (doc.width and doc.height).....this puzzles me a LOT!
He reinstalled many times already, still nogo......
Any thoughts? the problem seems the size of selection (doc.selection.select(selectionBounds,SelectionType.REPLACE,0,false);
)


//create the 4 backgroundlayers with colors
var selectionBounds = [[0,doc.height],[doc.width,doc.height],[doc.width,0],[0,0]];
for (var b = 0;b<4;b++) {
var newLayerRef = doc.artLayers.add();
newLayerRef.name = layerBGArrNames[b];

var randomColor = new SolidColor;
randomColor.rgb.red = layerBGArrColors[b][0];
randomColor.rgb.green = layerBGArrColors[b][1];
randomColor.rgb.blue = layerBGArrColors[b][2];

doc.selection.select(selectionBounds,SelectionType.REPLACE,0,false);

doc.selection.fill(randomColor);
doc.selection.deselect();

randomColor = null;

}

xbytor
01-12-2005, 05:32 AM
Verify that your ruler units preferences are set explicitly and consistently. And remember that not all apis will take all units. Some, apparently, require pixels units. Units are not dealt with very well in JS.

ciao,
-X

babedieboe
01-12-2005, 05:58 AM
that did it: i set the units to pixels runtime, et voila! thx m8!