Applescript多个“告诉应用程序”

问题描述 投票:0回答:1

我需要编写一个脚本,该脚本将在Photoshop中启动该动作,然后执行save命令,但是仅启动脚本的第一部分。仅执行“告诉应用程序Photoshop”操作,然后卡住...这两个脚本分别工作

on run {input, parameters}
    tell application "Adobe Photoshop CC 2018"
        do action "1 layer" from "To png"
    end tell
    tell application "System Events"
            key code 48
            key code 48
            key code 48
            key code 48
            key code 48
            key code 126
            key code 35
            key code 45
            key code 5
            key code 76
            key code 76
            key code 76
    end tell
return input
end run
applescript action photoshop multiple tell
1个回答
0
投票

尝试此修改:

on run {input, parameters}
    tell application "Adobe Photoshop CC 2018"
        do action "1 layer" from "To png"
    end tell
    tell application "System Events"
        tell process "Adobe Photoshop CC 2018"
            key code 48
            key code 48
            key code 48
            key code 48
            key code 48
            key code 126
            key code 35
            key code 45
            key code 5
            key code 76
            key code 76
            key code 76
        end tell
    end tell
    return input
end run

在您的代码中,key code事件被发送到进程“系统事件”,该进程是不接受键事件的后台应用程序。您想使用指示的tell块将按键事件定向到Photoshop。

© www.soinside.com 2019 - 2024. All rights reserved.