copies/pastes 文本在 Yosemite 中损坏的 Apple 脚本

Apple Script that copies/pastes text is broken in Yosemite

我制作了一个简单的 AppleScript,它从 Photoshop 复制图层名称并将它们粘贴到 Illustrator 中。它在 Mountain Lion 中运行良好,但现在在 Yosemite 中无法正常运行。它重复 6 次,但它似乎没有在第一次 运行 时激活 Illustrator。它会重复激活 Illustrator 5 次。这是:

repeat 6 times
tell application "Adobe Photoshop CC 2014" to activate
tell application "System Events"
    tell process "Photoshop"
        keystroke "/" using command down
        keystroke "c" using command down
        keystroke tab
    end tell
end tell
delay 0.3
tell application "Adobe Illustrator" to activate
tell application "System Events"
    tell process "Illustrator"
        keystroke "v" using command down
        keystroke return
        keystroke "-"
        keystroke space
    end tell
end tell
end repeat
end

感谢您的帮助!

tell application "System Events" to repeat 6 times

    tell process "Photoshop" to repeat until frontmost is true
        set frontmost to true
        delay 1
    end repeat
    keystroke "/" using command down
    keystroke "c" using command down
    keystroke tab

    tell process "Illustrator" to repeat until frontmost is true
        set frontmost to true
        delay 1
    end repeat
    keystroke "v" using command down
    keystroke return
    keystroke "-"
    keystroke space

end repeat