编程。 AppleScript 编辑器。大于、小于 If 语句

Programming. AppleScript Editor. Greater Than, Less Than in If statements

好吧,我想看看 "user" 是否输入了大于 10 的数字,但我不知道把它放在哪里或如何输入。

set volume 10
say "Hello and Welcome to Tyler's Spam Bot"

set amount to text returned of (display dialog "How many times?" default answer "More than 10")
repeat amount times
    tell application "Finder" to make new Finder window
    if amount comes before 10 then
        return true
    else
        return false
    end if
end repeat

检查是否可以使用 try/on 错误块将值转换为整数。如果可以,继续,询问是否大于10;如果是,请执行您的操作。

set received_integer to "False"

repeat while received_integer is not "True"
    set amount to text returned of (display dialog "How many times?" default answer "More than 10")

    try
        set amt_as_int to amount as integer
        if amt_as_int ≥ 10 then
            set received_integer to "True"
            repeat amt_as_int times
                tell application "Finder" to make new Finder window
            end repeat
        end if
    end try

end repeat