Applecript&数字错误将变量设置为数字中空单元格的值

时间:2016-03-06 23:48:46

标签: numbers applescript

从未使用过Applecript,而且只是编码时最讨厌

tell application "Numbers"
    tell front document to tell sheet 1 to tell table 1
    set col to 3
    repeat
        set ABCD to value of cell {row 2, column col}
        if value of cell {row foundRow, column col} is missing value then display dialog "yay"
        exit repeat
        set col to col + 1
    end repeat
end tell

我把代码拆开并为你简化它,但不管我怎么把它拉扯起来试图拉出那个单元格为空的单元格的值给我一个错误,我甚至无法提取值对它进行测试...缺失价值...所以我不知道任何帮助都会受到赞赏

1 个答案:

答案 0 :(得分:0)

我没有Numbers,所以我无法测试这段代码,但是我会从我看到的内容中做出一些改变。看来你正试图找到一个空白栏?在你的问题中你没有说清楚。如果是这样,我会尝试这样的事情。 (再次,这是未经测试的)

set foundBlank to false
set lastColumnToCheck to 30

tell application "Numbers"
    tell table 1 of sheet 1 of front document

    repeat with col from 3 to lastColumnToCheck
        set ABCD to value of cell {row 2, column col}
        if ABCD = "" then
            set foundBlank to true
            exit repeat
        end if
    end repeat
end tell

if foundBlank then
    display dialog "Yay!"
else
    display dialog "Boo!"
end if