Photoshop: How to get value if "snap to guides" is enabled via a script?

  • 1
  • Question
  • Updated 2 years ago
  • (Edited)
How to get value if "snap to guides" is enabled?

This is output from Script Listener if I record action
var idslct = charIDToTypeID( "slct" );
var desc9 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idMn = charIDToTypeID( "Mn " );
var idMnIt = charIDToTypeID( "MnIt" );
var idsnapToGuides = stringIDToTypeID( "snapToGuides" );
ref1.putEnumerated( idMn, idMnIt, idsnapToGuides );
desc9.putReference( idnull, ref1 );
executeAction( idslct, desc9, DialogModes.NO );
I can't see anything like "true, false, boolean" ...I guess this only select and run menu item.

Is there posibility get value with this?
getCustomOptions(key);
With this script was possible check if snap to pixel grid is enabled. This doesn't work now.
function snapToPixelGridEnabled() {
	var ref = new ActionReference();
ref.putProperty(cTID('Prpr'), cTID('GnrP'));
ref.putEnumerated(cTID('capp'), cTID('Ordn'), cTID('Trgt'));
var desc = executeActionGet(ref);
var gnrp = desc.getObjectValue(cTID('GnrP'));
return gnrp.getBoolean(sTID('transformsSnapToPixels'));
}
I am able to get value via Data Browser like
app.preferences.gridStyle
or
app.preferences.gridSubDivisions
But there is nothing like "show" or "snap".
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 761 Posts
  • 149 Reply Likes
  • lost in code

Posted 2 years ago

  • 1
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 761 Posts
  • 149 Reply Likes
With this script http://www.tonton-pixel.com/blog/scripts/utility-scripts/get-document-info-code/ I can get code with this values:
        "targetPathVisibility":
	{
		"<boolean>": true
	},
	"guidesVisibility":
	{
		"<boolean>": true
	},
	"smartGuidesVisibility":
	{
		"<boolean>": true
	},
	"rulersVisibility":
	{
		"<boolean>": true
	}
So it's possible somehow.