AppleScript - finding creation/modification dates for files
-
29-10-2019 - |
Question
I have simple service I'm using to import Evernote files:
on run {input} tell application "Evernote" repeat with x in input try create note from file x on error error_message number error_number display alert "Send to Evernote Failed" message "Error: " & error_message & "" & "Error Number: " & error_number as warning end try end repeat end tell end run
I would like to "create note from file x created d", where d is a date/time that matches that of the original file - but I don't know how to get the date/time (either created or modified) of the original file in a format that is an applescript date.
I appreciate the help!
Solution
I don´t know where you´re getting your "input" from, but assuming that with "files" you literally mean files int the Finder, calling Finder to get info on the file in "input" should work like this:
tell application "Finder" to set input to selection
repeat with x in input
tell application "Finder" to set creationDate to creation date of x
end repeat