I am trying to stop a script if no layer is selected.
I am finding it wierd why this command returns the first layer even if nothing is selected
I tried doing try catch instead of throwing an error when no layer is selected. But that also didn't work
Folks, I am new here. Please guide to help me understand better
s2t = stringIDToTypeID; (r = new ActionReference()).putProperty(s2t('property'), p = s2t('targetLayers')); r.putEnumerated(s2t("document"), s2t("ordinal"), s2t("targetEnum")); if (!executeActionGet(r).getList(p).count) alert('no layers selected')
So since you asked about stopping the script. You can use jazz-y's script. Create a variable called run and set it to true. Create an if statement for all your routine code and have the condition be the run variable. Then in jazz-y's script, change the run variable to false, if no layer is select. Tje script will then bypass all your code in the if statement and end.