Skip to main content
Inspiring
May 14, 2026
Answered

script : how to confirm that the pathitem is a dashed line?

Hi everyone,

 

my requirement is to delete pathitems that is dashed line, but how do I determine if an item is dashed ? thanks

    TySprice
    TySpriceCorrect answer
    Inspiring
    May 14, 2026
    try {

    alert(String(app.activeDocument.selection[0].strokeDashes.length > 0));

    }catch(e) {
    //Do nothing, invalid object selected
    }

    Here is some code that will alert “true” if the first selected object has a dashed stroke and “false” if the stroke is not dashed.

    5 replies

    rui huangAuthor
    Inspiring
    May 14, 2026

    thanks

    Translate
    TySprice
    TySpriceCorrect answer
    Inspiring
    May 14, 2026
    try {

    alert(String(app.activeDocument.selection[0].strokeDashes.length > 0));

    }catch(e) {
    //Do nothing, invalid object selected
    }

    Here is some code that will alert “true” if the first selected object has a dashed stroke and “false” if the stroke is not dashed.

    Translate
    rui huangAuthor
    Inspiring
    May 14, 2026

    Thank you very much for your answer.

    Translate
    TySprice
    Inspiring
    May 14, 2026

    I liked your answer better. 😅 So I revised my answer to be closer to what you had.

     

    Translate
    rui huangAuthor
    Inspiring
    May 14, 2026

     

    Translate