Applescript / Photoshop:用图像创建新图层

时间:2011-08-02 00:18:53

标签: macos applescript photoshop

如何在包含该图层中的图像的文档中创建新图层?我正在使用Pohotoshop CS5和AppleScript。 我知道如何制作一个像这样的新图层:

    set newLayer to make art layer with properties {name:"LayerA"}

只是不知道如何在其中放置图像。 感谢。

1 个答案:

答案 0 :(得分:1)

如果您需要直接从文件中复制,那就更复杂,并且需要打开另一个应用程序(预览)并从预览中复制它。这可能会有所帮助:

    set this_picture to choose file
tell application "Preview"
    activate
    open this_picture
end tell
tell application "System Events"
    tell process "Preview"
        keystroke "a" using command down
        keystroke "c" using command down
    end tell
end tell
tell application "Preview" to quit

要求提供图像,打开预览,选择所有图像,复制图像,然后退出。

然后将其粘贴到Photoshop中:

tell application "Adobe Photoshop CS5"
        activate
    end tell
    tell application "System Events"
        tell process "Adobe Photoshop CS5"
            set newLayer to make art layer with properties {name:"LayerA"}
            keystroke "v" using command down
        end tell
    end tell

基本上就是这样!希望在某种程度上有所帮助。