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



如何在文档中创建一个新图层并在该图层中添加图像?我正在使用photoshop CS5和AppleScript。我知道如何新建一个图层,像这样:

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

就是不知道怎么放图片进去。谢谢。

如果你需要直接从文件中复制它,那就更复杂了,需要打开一个不同的应用程序(预览)并从预览中复制它。这可能有帮助:

    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

基本上就是这样!希望对大家有所帮助。

最新更新