Scripting repetitive tasks
I'm trying to script several reptitive tasks as follows
- Select all pixels on layer "BG Colour" and replace with current Foreground colour. Same as if you command+click on the layer. The layer has a 60% opacity if it makes a difference.
- Select all pixels on layer "Border Colour" and replace with current Foreground colour. Same as if you command+click on the layer.
- Replace all text with specified value (Would be happy with it just bringing up the find/replace dialogue box)
I've worked out how to select the layer and select a specified point, but not all pixels & replace colour
var doc = app.documents[0];
app.activeDocument = doc;
var layers = app.activeDocument.layers;
// Text BG
var layerName = "Text BG";
var myLayer = layers[layerName];
app.activeDocument.activeLayer = myLayer;
makeSelection(224,439,102,7);
// Border Colour
// Selection Function
// x, y, width, height
// x & y position from top left corner of document
// width & height of selection
function makeSelection(x,y,sw,sh){
app.activeDocument.selection.select([ [x,y], [x,y+sh], [x+sw,y+sh], [x+sw,y] ]);
}