Hi
Based on different script, I’m trying to set a red label to all images with width under 4000px.
For one selected file, it works:
set this_file to choose file
try
tell application "Image Events"
launch
set this_image to open this_file
set the props_rec to the properties of this_image
close this_image
copy (dimensions of props_rec) to {x, y}
end tell
if x < 4000 then
tell application "Finder"
set label index of this_file to 2 --red label
display dialog "Rouge"
end tell
end if
on error error_message
display dialog error_message
end try
But for a selected folder, it doesn’t work; it opens Preview…
set DossierSource to choose folder with prompt "Choisissez le dossier contenant les images" without invisibles
with timeout of (5 * 60) seconds
tell application "Finder"
set fl to every item of folder DossierSource
end tell
repeat with this_file in fl
tell application "Image Events"
launch
set this_image to open this_file
set the props_rec to the properties of this_image
close this_image
copy (dimensions of props_rec) to {x, y}
end tell
if x < 4000 then
tell application "Finder"
set label index of this_file to 2 --red label
display dialog "Rouge"
end tell
end if
end repeat
end timeout
What’s wrong?