首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在循环中获取项目2

无法在循环中获取项目2
EN

Stack Overflow用户
提问于 2020-11-03 05:10:35
回答 1查看 24关注 0票数 0

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

不管是什么原因,我在循环中第二次得到一个错误,说它不能得到第二个项目。(第5行出现错误)

代码:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-03 05:39:20

您必须获取currentDocs的项目n

代码语言:javascript
复制
set currentDoc to item n of currentDocs

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

代码语言:javascript
复制
repeat with currentDoc in currentDocs
   tell currentDoc ...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64653375

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档