Skip to main content
Inspiring
May 14, 2026 12:40 AM UTC
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 1:37 AM UTC
    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 1:37 AM UTC

    thanks

    Translate
    TySprice
    TySpriceCorrect answer
    Inspiring
    May 14, 2026 1:37 AM UTC
    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 1:39 AM UTC

    Thank you very much for your answer.

    Translate
    TySprice
    Inspiring
    May 14, 2026 1:45 AM UTC

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

     

    Translate
    rui huangAuthor
    Inspiring
    May 14, 2026 12:48 AM UTC

     

    Translate