문제

AppleScript의 셀에 대한 완전한 참조에 액세스하려고합니다. 지금까지 나는 다음과 같은 스크립트를 사용하여 셀 참조와 테이블 참조를 얻었습니다.

tell application "Numbers"
tell document 1
repeat with i from 1 to count of sheets
tell sheet i
repeat with j from 1 to count of tables
tell table j
try
set currentCell to the first cell of the selection range
return name of currentCell
end try
end tell
end repeat
end tell
end repeat
end tell
end tell

시트 나 문서 참조를 얻기 위해 동일한 구조를 얻을 수없는 것 같습니다. 나는 셀의 특성에 액세스하려고 시도했고 다음과 같은 것을 얻습니다.

{column:column "A" of table "Table 1" of sheet "Sheet 1" of document "Untitled" of
 application "Numbers", alignment:center, value:0.0, background color:{59111, 59111, 
59111}, text color:{0, 0, 0}, font size:10.0, vertical alignment:top, name:"A1",
 class:cell, font name:"HelveticaNeue", format:automatic, row:row "1" of table "Table
 1" of sheet "Sheet 1" of document "Untitled" of application "Numbers", text 
wrap:true}

따라서 셀의 열 특성은 완전한 참조를 포함하는 것으로 보이지만 열 속성을 통해 직접 참조에 액세스하는 경우. 누구든지 사과 스크립트를 사용하여 시트를 얻고 문서화하는 방법에 대한 지침을 줄 수 있습니까?

건배

이안

도움이 되었습니까?

해결책

코드가 올바른 순서가있는 한 상당히 간단한 솔루션을 찾았습니다.

tell application "Numbers"
tell document 1
    repeat with i from 1 to count of sheets
        tell sheet i
            repeat with j from 1 to count of tables
                try
                    tell table j
                        set currentCell to the first cell of the selection range
                        set therow to row of currentCell
                        set sheetNumber to i
                    end tell
                end try
            end repeat
        end tell
    end repeat
    return name of sheet sheetNumber
end tell
end tell

유사한 코드를 사용하여 문서 번호를 확인할 수 있습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top