Copy link to clipboard
Copied
Hello !
I'm trying to make an applescript that will run a batch procedure in photoshop and I don't know how to write its code. Let me show my script :
set pasta_evento to choose folder with prompt "Select folder of the event: "
set pasta_tratadas to (pasta_evento as string) & "Tratadas:" as alias
set arq_log to (pasta_evento as string) & "Log_Erros.txt"
tell application "Finder"
if not (exists file arq_log) then
make new file at pasta_evento with properties {name:"Log_Erros.txt"}
end if
end tell
set Fotos to files of pasta_evento as alias list
tell application "Adobe Photoshop CS6"
activate
set display dialogs to never
batch "13 x 19 + sharpen" from files Fotos from "My Actions" with options {destination:folder, destination folder:pasta_tratadas, error file:alias arq_log}
end tell
When I run it, Photoshop opens a dialog informing : "There were no source files that could be opened by Photoshop".
I realized that if I change the instruction as below, it works. So, there's something wrong with the variable Fotos - I tried to feed it with strings but didn't know how to do it.
tell application "Adobe Photoshop CS6"
activate
set display dialogs to never
batch "13 x 19 + sharpen" from files {"Disk:Users:Me:Pictures:Macros:Tratadas:0002.JPG", "Disk:Users:Me:Pictures:Macros:Tratadas:0025.JPG"} from "My Actions"
When I run the same script with the batch, Photoshop says there's something wrong with the batch command. I tried to read the photoshop applescript ref, but I don't know what's wrong.
Could anybody help me correct this code ? I'm not definetively an expert!
Some refs about batch and batch options :
batch v : run the batch automation routine
batch text : the name of the action to play (note that the case of letters in the Action name is important and must match the case of the name in the Actions palette)
from files list of alias : list of input files to operate on
from text : the name of the action set containing the action being played (note that the case of letters in the Action Set name is important and must match the case of the name in the Actions palette)
[with options batch options] : options for Batch
batch options n : options for the Batch command
properties
destination (folder/‌none/‌save and close) : final destination of processed files ( default: none )
destination folder (alias) : folder location when using destination to a folder
error file (alias) : file to log errors encountered, leave this blank to stop for errors
file naming (list of ddmm/‌ddmmyy/‌document name 3/‌document name lower/‌document name mixed/‌extension lower/‌extension upper/‌mmdd/‌mmddyy/‌serial letter lower/‌serial letter upper/‌serial number four/‌serial number one/‌serial number three/‌serial number two/‌yyddmm/‌yymmdd/‌yyyymmdd) : list of file naming options 6 max.
macintosh compatible (boolean) : make final file name Macintosh compatible ( default: true )
override open (boolean) : override action open commands ( default: false )
override save (boolean) : override save as action steps with destination specified here ( default: false )
startingserial (integer) : starting serial number to use ( default: 1 )
suppress open (boolean) : suppress file open options dialogs ( default: false )
suppressprofile (boolean) : suppress color profile warnings ( default: false )
unix compatible (boolean) : make final file name Unix compatible ( default: true )
windows compatible (boolean) : make final file name Windows compatible ( default: true )
Tks !
Copy link to clipboard
Copied
This forum is for beginners in Photoshop. You might want to try the scripting forum here:
http://forums.adobe.com/community/photoshop/photoshop_scripting
Copy link to clipboard
Copied
Hi there! Because the forum you originally posted in is for beginners trying to learn the basics of Photoshop, I moved your question to the Photoshop Scripting forum, where you'll get more specialized help.
Copy link to clipboard
Copied
List of files must be not an alias, but a text string.
Adding something like that to your code must help:
set PhotoshopFiles to files of folder_to_run as alias list
set FileNames to {}
repeat with i from 1 to the count of PhotoshopFiles
set current_file to item i of PhotoshopFiles
copy current_file as text to the end of FileNames
end repeat
tell application "Adobe Photoshop CS6"
activate
try
set Batch_Options to {class:batch options, destination:save and close, error file:Error_File, file naming:{document name lower, extension lower}, macintosh compatible:true, override open:false, override save:true, suppress open:true, suppressprofile:true, unix compatible:true, windows compatible:true}
batch script_name from files FileNames from action_set_name with options Batch_Options
end try
end tell