2014-11-09 2 views
0

누군가 오류를 제거하는 데 도움을 줄 수 있습니까?AppleScript의 누락 값

오류 "누락 된 값을 유형 번호로 변환 할 수 없습니다." 번호가 누락 된 숫자 -1700

tell application "Numbers" 
    activate 
    open theFile 
    tell the first table of the active sheet of document 1 
     repeat with i from 2 to the count of rows of column "D" 
      set val1 to value of cell i of column "D" 
      set the value of cell i of column "D" to val1 * -1 
     end repeat 
    end tell 
end tell 

고마워요!

답변

1

기본적으로 셀에 값이 없으므로 테이블에 빈 행이 있어야합니다. 가장 쉬운 방법은 val1에 -1을 곱할 수없는 경우 모든 오류를 무시하는 try 블록을 사용하는 것입니다.

tell application "Numbers" 
    activate 
    open theFile 
    tell the first table of the active sheet of document 1 
     repeat with i from 2 to the count of rows of column "D" 
      set val1 to value of cell i of column "D" 
      try 
       set the value of cell i of column "D" to val1 * -1 
      end try 
     end repeat 
    end tell 
end tell