Please help, script for select Elliptical Marquee Tool wont work
Hi there! - Please help me.
I'm trying to automate average blur circles using the Elliptical Marquee Tool across the canvas within a grid and I keep getting the Rectangular Marquee Tool instead. Also the average blur isnt working, it's giving me the colour thats I've eyedropped previously. Please see below script.
@JJMack maybe you might know?
// Function to create a guide
function createGuide(position, direction) {
var id10 = charIDToTypeID( "Mk " );
var desc3 = new ActionDescriptor();
var id11 = charIDToTypeID( "Nw " );
var desc4 = new ActionDescriptor();
var id12 = charIDToTypeID( "Pstn" );
desc4.putInteger( id12, position );
var id13 = charIDToTypeID( "Ornt" );
desc4.putEnumerated( id13, id13, charIDToTypeID(direction) );
var id14 = charIDToTypeID( "Gd " );
desc3.putObject( id11, id14, desc4 );
executeAction( id10, desc3, DialogModes.NO );
}
// Set up variables
var numColumns = 56;
var numRows = 39;
var gridSize = 250;
// Create the grid of guides
for (var i = 0; i < numColumns; i++) {
var x = i * gridSize;
createGuide(x, "Vrtc");
}
for (var j = 0; j < numRows; j++) {
var y = j * gridSize;
createGuide(y, "Hrzn");
}
// Create the Elliptical Marquee tool for each grid and find the blur average
for (var i = 0; i < numColumns; i++) {
for (var j = 0; j < numRows; j++) {
// Select the grid
var x = i * gridSize;
var y = j * gridSize;
activeDocument.selection.select([[x, y], [x + gridSize, y], [x + gridSize, y + gridSize], [x, y + gridSize]], SelectionType.REPLACE);
// Create a new layer for the blur average
var newLayer = activeDocument.artLayers.add();
newLayer.name = "Blur Average " + (i + 1) + ", " + (j + 1);
// Fill the selection with the blur average
activeDocument.selection.fill(app.foregroundColor);
activeDocument.selection.deselect();
}
}
