How to test if command line argument is entered?

applescript

Solution

on run argv
    if (count of argv) > 0 then
        return "defined"
    else
        return "undefined"
    end if
end run

Problem

For my script, I'm getting an argument from user input on the command line, and I want to make sure the user doesn't forget to input the argument. So basically, I want to make my script do something like this: ``` on run argv if (item 1 of argv exists) then return "defined" else return "undefined" end if end run ``` Right now the part that says (item 1 of argv exists) does not work, but I hope someone can help me out. Thanks!

Original source