I am trying to write a Smart Rule to execute an Apple Script to copy the data in “Created” for eml (email) files to a custom metadata field called “emaildatetime” (ideally not applying the rule if the Created data already been replicated in the custom metadata field (assume that would avoid needlessly running the script on email files that have already been processed with the rule?)
Wondering why this script is not working. is there a different way to reference in the script the Created metadata in eml file ?
on performSmartRule(theRecords)
tell application id “DNtp”
repeat with thisRecord in theRecords
try
set theDate to creation date of thisRecord
add custom meta data theDate for “emaildatetime” to thisRecord
end try
end repeat
end tell
end performSmartRule
______
among the use cases - want to convert eml files with images that have to click to see in eml file to rtfd files where can see the images inline - but DT makes creation date of rtfd file the time of rtfd file creation.
Want to be able to sort the rtfd files (converted from eml) by the date of email (which is the info in the Created metadata for the eml file)
How did you run this script? Via smart rules or batch processing? Or in the Script Editor.app?
What do you mean when you say the script does not work? And why do you want to duplicate the creation date in a custom metadata field?
Don’t use try… end try blocks while you’re developing. You’re masking errors. You should use them after things are ironed out or if you’re using them as pseudo-conditionally.
Need to create rtfd files from eml files that have attached images so can see images inline (in eml files, only see the image file name and have to click / open to see what the image is).
If create an rtfd file from the eml file, the images show inline in the rtfd file but the rtfd creation date becomes the date/ time of rtfd file creation.
Want custom metadata field for rtfd files that equals creation date of the eml file from which the rtfd file created so can sort rtfd files by date of the email whose contents are in the rtfd file.
have been trying to use as part of smart rule that would run when an eml file imported to a group.
No you don’t. Disable Settings > Files > Emails > Use Alternative View and reselect the email. It will use Apple’s QuickLook to view the email similar to what you’d see in Apple Mail or the Finder.
1 Like