Jump to content
  • 0

Set note created date by highlighting text in note (then copy and AppleScript)


adamind

Idea

Hi all,
 
I'm in the habit of setting the created date of documents I add into Evernote as the actual date included in the text of the document.
 
For example, when I scan a receipt as a PDF and add it to Evernote, I select and copy the date in the body of the receipt, then use the information pop-up to paste in the created date.
 
Evernote does a great job of converting whatever date format has been pasted in to the correct format - even with Australian date format. For example, if I've selected and copied "01/08/14" from the body of the receipt note, then paste this in to the created date field, Evernote cleans this up and the resulting create date is "1 August 2014 9:02 am" - where the text I've copied doesn't include a time element Evernote keeps the existing time in the created field and just changes the date elements which is fine.
 
This involves a lot of cut and paste so I'm wondering.....
 
Is there a way to simply select text in Evernote and use a keyboard shortcut to set the highlighted text as the created date?
 
As a workaround, I had a go at creating an AppleScript to set the 'creation date' of a note to the text on the clipboard (after selecting and copying it):

 

------------

 
tell application "Evernote"
 
--get date from clipboard
set creationdateclipboard to the clipboard
 
set creationdate to (date creationdateclipboard)
 
--get selected notes
set changedatenotes to selection
 
--loop through selected notes
repeat with currentchangedatenote in changedatenotes
 
--set creation date of current
set creation date of currentchangedatenote to creationdate
 
end repeat
 
end tell
 

------------ 
 

This is almost working..... but not quite. I think I'm missing something with date format.

 

For example, if I have "01 Aug 2014" in the clipboard and run the script above, I get this error:

 

error "Evernote got an error: Can’t get date \"01 Aug 2014\"." number -1728 from date "Friday, 1 August 2014 12:00:00 am"

 

Also, if I have "01/08/2014" in the clipboard and run the script above, I get this error:
 

error "Evernote got an error: Can’t get date \"01/08/2014\"." number -1728 from date "Friday, 1 August 2014 12:00:00 am"

 

Any ideas please?

 

Thanks!

Link to comment

2 replies to this idea

Recommended Posts

Thanks for the tip.

 

Ended up with the following that does the job.

set creationdateclipboard to the clipboardset creationdate to date creationdateclipboardtell application "Evernote"set x to selectionset y to item 1 of xset creation date of y to creationdateend tell
Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...