我想寫一個腳本,需要多個項目,我已經在Photoshop中編輯並在Illustrator中打開它們,進行一些更改,保存一堆不同的方法,然後關閉項目並打開下一個項目。除了在Illustrator中打開photoshop文件之外,我已經可以工作了。所有的項目將位於同一個文件夾中,所以我嘗試使用查找器將所有這些文件設置爲列表,然後在Illustrator中打開文件。下面是代碼:如何使用Applescript在Illustrator中打開Photoshop項目?
tell application "Finder"
set theFiles to files of folder POSIX file "/Volumes/Assets/BLG.com Images/Images for Renaming/Photoshop Files" as list
end tell
repeat with f in theFiles
tell application "Adobe Illustrator"
activate
open f with options {class:Photoshop options, preserve hidden layers:true, preserve layers:true} without dialogs
set allLayers to layers of document 1
set allImages to page items of document 1
repeat with lay in allLayers
set visible of lay to true
end repeat
repeat with img in allImages
set scaleMatrix to get scale matrix horizontal scale 416 vertical scale 416
transform img using scaleMatrix
end repeat
selectobjectsonactiveartboard document 1
delay 2
do script "Fit Artboard to Selected" from "Fit Artboard"
set visible of layer 2 of document 1 to false
set visible of layer 4 of document 1 to false
delay 2
do script "Raw Copper Save" from "RC"
set visible of layer 5 of document 1 to false
delay 2
do script "Architectural Copper Save" from "AR"
set visible of layer 6 of document 1 to false
delay 2
do script "Satin Antique Save" from "SA"
set visible of layer 7 of document 1 to false
delay 2
do script "Brushed Nickel Save" from "BN"
set visible of layer 8 of document 1 to false
delay 2
do script "Polished Nickel Save" from "PN"
set visible of layer 10 of document 1 to false
set visible of layer 9 of document 1 to false
delay 2
do script "Antique Copper Save" from "AC"
set visible of layer 11 of document 1 to false
delay 2
do script "Verdigris Patina Save" from "VG"
set visible of layer 12 of document 1 to false
delay 2
do script "Satin Verdigris Patina Save" from "SV"
set visible of layer 13 of document 1 to false
set visible of layer 2 of document 1 to true
delay 2
do script "Black Save" from "BK"
set visible of layer 14 of document 1 to false
set visible of layer 2 of document 1 to false
set visible of layer 15 of document 1 to false
delay 2
do script "Default Save" from "Default"
delay 2
save document 1 in "/Volumes/Assets/BLG.com Images/Images for Renaming/Illustrator Files" as Illustrator
delay 2
close document 1
end tell
end repeat
目前該代碼將打開在Photoshop中,而不是在Illustrator中的文件,這真的讓我困惑,因爲我說的是Illustrator的應用程序打開它,沒有取景器。任何有識之士都會非常感激。試圖找出這個問題,一直在我的桌子上敲我的頭。
導入選項仍然彈出。我覺得很難相信沒有什麼方法可以自動化,但我猜這是可能的,你必須點擊。感謝您的幫助!非常感謝! – Adam
不要緊,這是行不通的!只要確保在Illustrator上進行硬重啓,就可以進行首選項更改。 – Adam