如何使用Applescript在Illustrator中打开Photoshop项目?

时间:2015-06-26 14:04:58

标签: scripting applescript

我正在尝试编写一个脚本,该脚本包含我在photoshop中编辑过的多个项目,并在Illustrator中打开它们,进行一些更改,以一堆不同的方式保存它们,然后关闭项目并打开下一个项目。除了在Illustrator中打开photoshop文件外,我还能正常工作。所有项目都将位于同一个文件夹中,因此我尝试使用finder将所有这些文件设置为列表,然后在illustrator中打开文件。这是代码:

1

目前此代码在photoshop中打开文件,而不是在Illustrator中打开文件,因为我告诉Illustrator应用程序打开它而不是查找程序,这真让我感到困惑。任何见解都将非常感激。一直在我的桌子上撞着我试图弄清楚这个。

3 个答案:

答案 0 :(得分:1)

这样做

tell application "Finder"
    set theFiles to files of folder "Assets:BLG.com Images:Images for Renaming:Photoshop Files" as alias list
end tell
tell application "Adobe Illustrator"
    activate
    tell Photoshop file options of settings
        set preserve hidden layers to true
        set preserve layers to true
    end tell
end tell
repeat with f in theFiles
    tell application "Adobe Illustrator"
        open f without dialogs
        set allLayers to layers of document 1
…

答案 1 :(得分:1)

最后一次尝试

tell application "Finder"
    set theFiles to files of folder "Assets:BLG.com Images:Images for Renaming:Photoshop Files" as alias list
end tell
tell application "Adobe Illustrator"
    set user interaction level to never interact
    activate
    set photoshopOptions to {class:Photoshop options, preserve layers:true, preserve hidden layers:true}
    set IllustratorPreferences to {class:Illustrator preferences, Photoshop file options:photoshopOptions}
end tell
repeat with f in theFiles
    tell application "Adobe Illustrator"
        open f without dialogs
        set allLayers to layers of document 1

 …

答案 2 :(得分:0)

您可以告诉Finder打开包含特定应用程序的文档。 请尝试这一点(保持开放线注释掉)

tell application "Finder"
    set theFiles to files of folder "Assets:BLG.com Images:Images for Renaming:Photoshop Files"
end tell
activate application "Adobe Illustrator"
repeat with f in theFiles
    tell application "Finder" to open f using application file id "com.adobe.illustrator"
    tell application "Adobe Illustrator"

        -- open f with options {class:Photoshop options, preserve hidden layers:true, preserve layers:true} without dialogs
        set allLayers to layers of document 1
…