tell application "EagleFiler"
set _records to selected records of browser window 1
tell library document 1
repeat with _record in _records
set _record's basename to my nameFromRecord(_record)
end repeat
end tell
end tell
on nameFromRecord(_record)
tell application "EagleFiler"
set _dateString to my dateStringFromDate(_record's creation date)
set _sender to _record's from name
set _title to _record's title
return _dateString & "-" & _sender & "-" & _title
end tell
end nameFromRecord
on dateStringFromDate(_date) -- YYYY-MM-DD
set _year to year of _date as string
set _month to my pad((month of _date as integer) as string)
set _day to my pad(day of _date as string)
return _year & "-" & _month & "-" & _day
end dateStringFromDate
on pad(_string)
if length of _string is 1 then
set _string to "0" & _string
end if
return _string
end pad