Saya menggunakan AppleScript untuk memproses folder gambar TIFF yang perlu dikonversi ke profil CMYK tertentu di Photoshop. Script pertama meminta folder yang berisi gambar dan kemudian meminta lokasi folder output. Namun, saya mendapatkan kesalahan berikut saat menjalankan skrip:
Adobe Photoshop CC 2015 mendapat kesalahan: Tidak bisa mendapatkan dokumen saat ini.
Hal pertama yang saya coba adalah menghapus current
dari perintah save. Tampaknya Photoshop sebenarnya membuka dan menyimpan dokumen setelah melakukan ini, namun, TIFF tidak ada dalam folder yang ditentukan di newFilePath
. Tidak yakin bagaimana saya harus menangani ini karena seharusnya memproses banyak file. Script saat ini di bawah:
on run
tell me to open {choose folder}
end run
on open droppedItems
set destFolder to choose folder with prompt "Select Output Folder"
repeat with anItem in droppedItems
tell application "Finder"
-- Make sure each item is processed by this script is a folder
if class of item anItem is not folder then
-- Not a folder, notify the user of the error
display dialog "Please drop folders containing images"
else
-- A folder, get the Adobe Photoshop files and process them
set fileList to (every file of anItem) as alias list
end if
end tell
HPConvert(fileList, destFolder)
end repeat
end open
-- fileList is a list of aliases to Photoshop files
-- destFolder is an alias to a folder where the converted TIFFs are to be saved
on HPConvert(fileList, destFolder)
set destPath to destFolder as string
repeat with aFile in fileList
tell application "Finder" to set fileName to name of aFile
set newFilePath to destPath & fileName
tell application "Adobe Photoshop CC 2015"
open aFile
convert to profile "CGATS21_CRPC6 V2" intent absolute colorimetric with dithering
save current document in file newFilePath as TIFF with options {embed color profile:true, save layers:true, save spot colors:true} appending lowercase extension
close current document saving no
end tell
end repeat
end HPConvert