Test for Auto and an alert

Hey everybody.


I want to test it with a script if a text layer using Auto leading and display an alert if it is not set to auto.

That's what I have now:

var doc = activeDocument

lay var = doc.activeLayer

textSize = lay.textItem.size var

textlayer var = doc.activeLayer

If (lay.textItem.autoLeading = "false") {}

{Alert ("Leading is set to a custom value of" + (activeDocument.activeLayer.textItem.leading) + ".")}

This works when something is on a specific attack. But when it is set to Auto leading I get this error.

So I know my 'IF' or 'VAR' needs to be reworked (probably alert too just to clean it up), but I'm out of ideas.

Screen Shot 2016-03-25 at 10.48.00 AM.png

First off, you will need to define you if statement with a double equal sign "is", if you set laytextItem.autoLeading to false. A trial to use catch block. If it throws an error, so you know, there are auto-attack.

Tags: Photoshop

Similar Questions

Maybe you are looking for