on performSmartRule(theRecords)
tell application id "DNtp"
repeat with theRecord in theRecords
if (type of theRecord is picture) then -- Shouldn't be necessary if smart rule criteria is set up correctly. However, it's not bad to error trap your code.
set recPath to (path of theRecord as string)
tell application "Image Events"
set theImage to open recPath
set {w, h} to dimensions of theImage -- Using a variable here is to satisfy an issue with Image Events.
scale theImage to size ((w / 2) as integer) -- Halving one dimension works as the scaling retains the aspect ratio of the original
save theImage
end tell
end if
set tags of theRecord to (tags of theRecord & "resized")
end repeat
end tell
end performSmartRule
↧
Smart rule not working
↧