无法让项目二进入循环

Can't get item two in loop

我正在尝试遍历 Photoshop 中所有打开的文档以获取每张图像的高度和宽度。

无论出于何种原因,我在循环中第二次收到错误消息,提示无法获取第二项。 (第 5 行错误)

代码:

tell application "Adobe Photoshop 2020"
    set currentDocs to documents
    set myList to {}
    repeat with n from 1 to count of currentDocs
        set currentDoc to current document of item n
        tell currentDoc
            set theDimensions to bounds of current layer
            set theWidth to item 3 of theDimensions
            set theHeight to item 4 of theDimensions
            set theDimensions to theWidth & theHeight
            set end of myList to theDimensions
        end tell
    end repeat
end tell

您必须获得 n 项,共 currentDocs

set currentDoc to item n of currentDocs

或使用repeat with ... in ...语法

repeat with currentDoc in currentDocs
   tell currentDoc ...