Skip to main content
Inspiring
May 14, 2026
Answered

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

  • May 14, 2026
  • 3 replies
  • 41 views

Hi everyone,

 

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

    Correct answer TySprice
    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.

    3 replies

    rui huangAuthor
    Inspiring
    May 14, 2026

    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.

    rui huangAuthor
    Inspiring
    May 14, 2026

    Thank you very much for your answer.

    TySprice
    Inspiring
    May 14, 2026

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

     

    rui huangAuthor
    Inspiring
    May 14, 2026