I’m using the following AppleScript in my Automator workflow:
on run {input, parameters}
--say input
set result_array to {} as list
try
repeat with this_file in input
tell application "Image Events"
launch
set this_image to open this_file
copy dimensions of this_image to {W, H}
close this_image
end tell
set text item delimiters to ":"
set file_name to last text item of (this_file as string)
set text item delimiters to ""
set filter_string to W & "x" & H as string
if file_name contains filter_string then
set the end of result_array to this_file
end if
end repeat
return result_array
on error error_message
display dialog error_message
end try
end run
The script runs after a Get Folder Contents action.
There is something wrong with the result array but I can’t figure out what.
The result has to be a list of files which have their size in their names.
If I understood correctly use one of the following :
Currently
this_fileis like a pointer to the original list of files. When used directly it includes the index of the current value and the full list.This is probably due to how the
repeat with a in bis implement in Applescript.