08.08.14, 15:24
Hi,
I am trying to make a simple script that would save all my layers to multiple files (an equivalent to the similar script Photoshop has). But the console keeps yelling at me Can't find method com.scriptographer.ai.Item.rasterize(com.scriptographer.ai.ItemList,string) message all the time.
var layers = document.layers; for (var i in layers) { var layer = layers[i]; // Select all for (var i in layer.children) { layer.children[i].selected = true; } var buffer = layer.rasterize(layer.children, "cmyk"); Packages.javax.imageio.ImageIO.write(buffer, "jpg", new java.io.File("/test.jpg")); }
Also, two more questions:
– Is it always required to list layer's children in order to get the layer selected? The Layer.selected parameter is described in the Reference as inherited...
layer.selected = true; // throws an error
– What about the Java stuff in the last statement? I got it from this forum and it seems to be incorrect too.
Can you help me out?
Jirka