Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Fixed Size Shape tool

Community Beginner ,
Apr 28, 2020 Apr 28, 2020

Using CC 21.0.1 on a PC.

In my work I have the need to place small "dot" on images to indicate points of interest.  I use the shape tool (ellipse) with the fill and stroke set to the same color to make the "dots".  To have them all be the same size I have set the Path options to fixed size (20px by 20px).  If I then click on the image and don't move the mouse I get a prompt asking how big I want to create the ellipse.  If I click and drag a small amout it drops the 20x20 dot on the image.  Is there a way to disable the pop-up prompt for shape size?  I want to be able to just click on the location I want the dot and have it placed on a new layer.  Having to drag a small amount to get the correct size is not user friendly.

595
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Apr 28, 2020 Apr 28, 2020

If you click and don't drag you will get the interactive create ellipse dialog with the 20px 20px you set in thetool option bar filled into the dialog. image.png

If you drag the interactive drag will replace the interactive dialog  the 20px by 20px in the tool bar will be changed to the bounds of the rectangle you drag out. An elliptical shape layer will be created. As shown below

Capture.jpg

 

The tool is an interactive tool you are required to interact with the tool via dialog or drag.  You can not even script it via a shortcut without first requiring user interaction for action and scripts can not get the current cursor location.  You would need to first set a color sampler point so the script can get the location to want the dot in.  The action manager code would require the script to get the color simpler location and the current target layer to be able to create the shape layer bounds and stack location.

 

The Shape functions would look like this. Many of the settings would be hard coded.

 

 

 

// =======================================================
make(255, 0, 0, 1, 250, 350, 270, 370, 2, true, true, 1, 0, 100, false, false, 100, 255, 0, 0, 99.999969, 5);
function make(red, Grn, blue, unitValueQuadVersion, top, left, bottom, right, strokeStyleVersion, strokeEnabled, fillEnabled, strokeStyleLineWidth, strokeStyleLineDashOffset, strokeStyleMiterLimit, strokeStyleScaleLock, strokeStyleStrokeAdjust, strokeStyleOpacity, red2, Grn2, blue2, strokeStyleResolution, layerID) {
	var descriptor = new ActionDescriptor();
	var descriptor2 = new ActionDescriptor();
	var descriptor3 = new ActionDescriptor();
	var descriptor4 = new ActionDescriptor();
	var descriptor5 = new ActionDescriptor();
	var descriptor6 = new ActionDescriptor();
	var descriptor7 = new ActionDescriptor();
	var descriptor8 = new ActionDescriptor();
	var list = new ActionList();
	var reference = new ActionReference();

	reference.putClass( stringIDToTypeID( "contentLayer" ));
	descriptor.putReference( charIDToTypeID( "null" ), reference );
	descriptor4.putDouble( stringIDToTypeID( "red" ), red );
	descriptor4.putDouble( charIDToTypeID( "Grn " ), Grn );
	descriptor4.putDouble( stringIDToTypeID( "blue" ), blue );
	descriptor3.putObject( stringIDToTypeID( "color" ), stringIDToTypeID( "RGBColor" ), descriptor4 );
	descriptor2.putObject( stringIDToTypeID( "type" ), stringIDToTypeID( "solidColorLayer" ), descriptor3 );
	descriptor5.putInteger( stringIDToTypeID( "unitValueQuadVersion" ), unitValueQuadVersion );
	descriptor5.putUnitDouble( stringIDToTypeID( "top" ), stringIDToTypeID( "pixelsUnit" ), top );
	descriptor5.putUnitDouble( stringIDToTypeID( "left" ), stringIDToTypeID( "pixelsUnit" ), left );
	descriptor5.putUnitDouble( stringIDToTypeID( "bottom" ), stringIDToTypeID( "pixelsUnit" ), bottom );
	descriptor5.putUnitDouble( stringIDToTypeID( "right" ), stringIDToTypeID( "pixelsUnit" ), right );
	descriptor2.putObject( stringIDToTypeID( "shape" ), stringIDToTypeID( "ellipse" ), descriptor5 );
	descriptor6.putInteger( stringIDToTypeID( "strokeStyleVersion" ), strokeStyleVersion );
	descriptor6.putBoolean( stringIDToTypeID( "strokeEnabled" ), strokeEnabled );
	descriptor6.putBoolean( stringIDToTypeID( "fillEnabled" ), fillEnabled );
	descriptor6.putUnitDouble( stringIDToTypeID( "strokeStyleLineWidth" ), stringIDToTypeID( "pixelsUnit" ), strokeStyleLineWidth );
	descriptor6.putUnitDouble( stringIDToTypeID( "strokeStyleLineDashOffset" ), stringIDToTypeID( "pointsUnit" ), strokeStyleLineDashOffset );
	descriptor6.putDouble( stringIDToTypeID( "strokeStyleMiterLimit" ), strokeStyleMiterLimit );
	descriptor6.putEnumerated( stringIDToTypeID( "strokeStyleLineCapType" ), stringIDToTypeID( "strokeStyleLineCapType" ), stringIDToTypeID( "strokeStyleButtCap" ));
	descriptor6.putEnumerated( stringIDToTypeID( "strokeStyleLineJoinType" ), stringIDToTypeID( "strokeStyleLineJoinType" ), stringIDToTypeID( "strokeStyleMiterJoin" ));
	descriptor6.putEnumerated( stringIDToTypeID( "strokeStyleLineAlignment" ), stringIDToTypeID( "strokeStyleLineAlignment" ), stringIDToTypeID( "strokeStyleAlignInside" ));
	descriptor6.putBoolean( stringIDToTypeID( "strokeStyleScaleLock" ), strokeStyleScaleLock );
	descriptor6.putBoolean( stringIDToTypeID( "strokeStyleStrokeAdjust" ), strokeStyleStrokeAdjust );
	descriptor6.putList( stringIDToTypeID( "strokeStyleLineDashSet" ), list );
	descriptor6.putEnumerated( stringIDToTypeID( "strokeStyleBlendMode" ), stringIDToTypeID( "blendMode" ), stringIDToTypeID( "normal" ));
	descriptor6.putUnitDouble( stringIDToTypeID( "strokeStyleOpacity" ), stringIDToTypeID( "percentUnit" ), strokeStyleOpacity );
	descriptor8.putDouble( stringIDToTypeID( "red" ), red2 );
	descriptor8.putDouble( charIDToTypeID( "Grn " ), Grn2 );
	descriptor8.putDouble( stringIDToTypeID( "blue" ), blue2 );
	descriptor7.putObject( stringIDToTypeID( "color" ), stringIDToTypeID( "RGBColor" ), descriptor8 );
	descriptor6.putObject( stringIDToTypeID( "strokeStyleContent" ), stringIDToTypeID( "solidColorLayer" ), descriptor7 );
	descriptor6.putDouble( stringIDToTypeID( "strokeStyleResolution" ), strokeStyleResolution );
	descriptor2.putObject( stringIDToTypeID( "strokeStyle" ), stringIDToTypeID( "strokeStyle" ), descriptor6 );
	descriptor.putObject( stringIDToTypeID( "using" ), stringIDToTypeID( "contentLayer" ), descriptor2 );
	descriptor.putInteger( stringIDToTypeID( "layerID" ), layerID );
	executeAction( stringIDToTypeID( "make" ), descriptor, DialogModes.NO );
}

 

 

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2020 Apr 28, 2020

JJ, thank you! For so long, I've been trying to preset the size via the little cogwheel, but no matter what I entered there, it defaulted to 100x100. Why do they even have that if it does nothing?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2020 Apr 29, 2020
LATEST

This script will not do exactly what you want but you may be able to get by setting a shortcut to use it to help do what you want to do. The script will create a new solid fill round 20px red shape in the document top left corner and select the move tool so you can drag the dot to the location you want it in.

var orig_ruler_units = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;	// Set the ruler units to PIXELS
// ============================================================================================================
// Reset Vars Used and create some alias to make things easier for this hacker
// ============================================================================================================ */
var type	= "None Set";
var shape	= "None Set";
// vars	for shape
var rectangle	="Rctn";
var ellipse	="Elps";
// vars	for Path
var doPath 	= false;
// vars	for type
var diminish	=SelectionType.DIMINISH
var subtract	=SelectionType.DIMINISH
var extend	=SelectionType.EXTEND
var add		=SelectionType.EXTEND
var intersect	=SelectionType.INTERSECT
var replace	=SelectionType.REPLACE
/* ============================================================================================================
// end vars and Aliases
// ============================================================================================================ */
setMarqueeSelection(0, 0, 20, 20, replace, ellipse, 0, false, true);	
solidFill(255, 0, 0)
selectTool('moveTool');
app.preferences.rulerUnits = orig_ruler_units;	// Reset units to original settings
	
/* SetMarqueeSelection function from Scriptlistner plugin
// ========================================================================== */
function setMarqueeSelection(x1, y1, x2, y2, type, shape, feather, antiAlias, doPath) {
	if (doPath ==null) { doPath = false; }
	var SelectionType =null;
	if (type ==null)      {	var SelectionType = "setd" }
	if (type ==diminish)  {	var SelectionType = "SbtF" }
	if (type ==extend)    {	var SelectionType = "AddT" }
	if (type ==intersect) {	var SelectionType = "IntW" }
	if (type ==replace)   {	var SelectionType = "setd" }

	var id3	= charIDToTypeID( SelectionType	);
	    var	desc2 =	new ActionDescriptor();
	    var	id4 = charIDToTypeID( "null" );
		var ref1 = new ActionReference();
		if (doPath) {
			var id5	= charIDToTypeID( "Path" );
			var id6	= charIDToTypeID( "WrPt" );
			}
		else {
			var id5	= charIDToTypeID( "Chnl" );
			var id6	= charIDToTypeID( "fsel" );
			}
		ref1.putProperty( id5, id6 );
	    desc2.putReference(	id4, ref1 );
	    var	id7 = charIDToTypeID( "T   " );
		var desc3 = new	ActionDescriptor();
		var id8	= charIDToTypeID( "Top " );
		var id9	= charIDToTypeID( "#Pxl" );
		desc3.putUnitDouble( id8, id9, y1 );
		var id10 = charIDToTypeID( "Left" );
		var id11 = charIDToTypeID( "#Pxl" );
		desc3.putUnitDouble( id10, id11, x1 );
		var id12 = charIDToTypeID( "Btom" );
		var id13 = charIDToTypeID( "#Pxl" );
		desc3.putUnitDouble( id12, id13, y2 );
		var id14 = charIDToTypeID( "Rght" );
		var id15 = charIDToTypeID( "#Pxl" );
		desc3.putUnitDouble( id14, id15, x2 );
	    var	id16 = charIDToTypeID( shape );
	    desc2.putObject( id7, id16,	desc3 );
	    var	id17 = charIDToTypeID( "Fthr" );
	    var	id18 = charIDToTypeID( "#Pxl" );
	    desc2.putUnitDouble( id17, id18, feather );
	    var	id19 = charIDToTypeID( "AntA" );
	    desc2.putBoolean( id19, antiAlias );
	executeAction( id3, desc2, DialogModes.NO );
}

function solidFill(red, green, blue) {
	var idMk = charIDToTypeID( "Mk  " );
		var desc177 = new ActionDescriptor();
		var idnull = charIDToTypeID( "null" );
			var ref58 = new ActionReference();
			var idcontentLayer = stringIDToTypeID( "contentLayer" );
			ref58.putClass( idcontentLayer );
		desc177.putReference( idnull, ref58 );
		var idUsng = charIDToTypeID( "Usng" );
			var desc178 = new ActionDescriptor();
			var idType = charIDToTypeID( "Type" );
				var desc179 = new ActionDescriptor();
				var idClr = charIDToTypeID( "Clr " );
					var desc180 = new ActionDescriptor();
					var idRd = charIDToTypeID( "Rd  " );
					desc180.putDouble( idRd, red );
					var idGrn = charIDToTypeID( "Grn " );
					desc180.putDouble( idGrn, green );
					var idBl = charIDToTypeID( "Bl  " );
					desc180.putDouble( idBl, blue );
				var idRGBC = charIDToTypeID( "RGBC" );
				desc179.putObject( idClr, idRGBC, desc180 );
			var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );
			desc178.putObject( idType, idsolidColorLayer, desc179 );
		var idcontentLayer = stringIDToTypeID( "contentLayer" );
		desc177.putObject( idUsng, idcontentLayer, desc178 );
	executeAction( idMk, desc177, DialogModes.NO );
	
	var idDlt = charIDToTypeID( "Dlt " );
		var desc198 = new ActionDescriptor();
		var idnull = charIDToTypeID( "null" );
			var ref65 = new ActionReference();
			var idPath = charIDToTypeID( "Path" );
			var idWrPt = charIDToTypeID( "WrPt" );
			ref65.putProperty( idPath, idWrPt );
		desc198.putReference( idnull, ref65 );
	executeAction( idDlt, desc198, DialogModes.NO );
}
function selectTool(tool) {
    var desc9 = new ActionDescriptor();
        var ref7 = new ActionReference();
        ref7.putClass( app.stringIDToTypeID(tool) );
    desc9.putReference( app.charIDToTypeID('null'), ref7 );
    executeAction( app.charIDToTypeID('slct'), desc9, DialogModes.NO );
};
JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines