Highlighted

how to remove "no markers detected" compiler error?

Community Beginner ,
Sep 09, 2020

Copy link to clipboard

Copied

i have created script about layer.marker and it works fine.

but when there are no marker on the layer, the error comes up.

is there any ways to hide the error? maybe like 'hasParent' function.

because i want to make it as preset and let the user freely to put the marker whenever they want.  thanks!

TOPICS
Error or problem, Expressions, How to, Scripting

Views

36

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

how to remove "no markers detected" compiler error?

Community Beginner ,
Sep 09, 2020

Copy link to clipboard

Copied

i have created script about layer.marker and it works fine.

but when there are no marker on the layer, the error comes up.

is there any ways to hide the error? maybe like 'hasParent' function.

because i want to make it as preset and let the user freely to put the marker whenever they want.  thanks!

TOPICS
Error or problem, Expressions, How to, Scripting

Views

37

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 09, 2020 0
Adobe Community Professional ,
Sep 10, 2020

Copy link to clipboard

Copied

Hey.

You can check for numKeys property to determine if a layer has any markers applied.

http://docs.aenhancers.com/properties/property/#property-numkeys

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 10, 2020 0
Adobe Community Professional ,
Sep 10, 2020

Copy link to clipboard

Copied

Sounds like you want to write expressions instead of a script, but also with expressions it is as Tomas said: Check for numkeys:

 

if (myLayer.marker.numKeys == 0) {
  // do here whatever you want to do when no marker exists
}
else {
  // do where whatever you want to do if a marker exists
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 10, 2020 0