Answered
select path item with script
How would you write to select path item "a" through a script in a situation like the one shown in the attached image?

How would you write to select path item "a" through a script in a situation like the one shown in the attached image?

layersはlengthプロパティを持ちます。レイヤー上でlengthを参照することで当該レイヤーがサブレイヤーを持つかどうかを判断可能です。また、サブレイヤーが存在しない状態であれば当該レイヤーを展開した状態で見えているのはpageItemsです。
で、示されたレイヤーパネルの状態ではa,b,c,dはpageObjectsとして存在し、サブレイヤーではありません。
各要素へのアクセスは、a,c,dでは
app.activeDocument.activeLayer.pageItems[0].selected = true;
bはサブレイヤー上の要素ですから
app.activeDocument.activeLayer.layers[0].pageItems[0].selected = true;
となります。
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.