SethG

Member
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

5 Neutral

About SethG

  1. Hi Saverio, The regex is preferred, because although it does generally put date last, if there are two documents from the same date, it appends an additional number (e.g., Amazon My Orders 2014-05-20 1.pdf). The regex approach should be more robust. As far as changing the title, you can simply use the "title" attribute. Adding something like these two lines at the bottom of the script should do the trick: set filestring to find text "[^0-9]+" in fname with regexp and string resultset title of statement to datestring & " " & filestringThis sets the 'filestring' variable to the attachment's filename, up to the first occurrence of a digit. It then sets the note title to the YYYY-MM-DD datestring found earlier in the script, prepended to the filestring. You can mess around with it to get the titles just as you prefer.
  2. So after having heard about it several times but never finding time to delve further into it, I finally signed up for FileThis (http://filethis.com) and connected several of my accounts to be automatically imported to Evernote. I was blown away by how straightforward the process was. It brought in the backlog of statements from my banks, credit cards, utilities, health insurance, and even Amazon.com orders, and will continue to do so automatically moving forward (by default, in the free tier, once per week.) The one major issue I had was that the creation/modified dates of the notes that were created were the date/time of the import into Evernote, not the dates of the statements themselves. The problem was exacerbated by the fact that many of the statements did not seem to be imported in chronological order (so, for instance, a statement from Dec 2012 appeared near the top of the list, while Mar 2014 was rather toward the bottom) and it seemed to be rather random. Not a huge deal for Premium subscribers, since they're searchable, but an annoyance nonetheless. After noticing that all of the PDF attachments were similarly formatted in their filenames, all including a YYYY-MM-DD format date, I wrote an AppleScript that went through and updated all of the create/modified dates of the FileThis-created notes to mirror the dates in the filenames. In order to make it flexible, I did use regular expressions, so you may need to download and install the Satimage osax extension (http://www.satimage.fr/software/downloads/Satimage392.pkg) in order to enable this capability. After that it's really quite straightforward. Including code here, since attaching AppleScript files is disallowed: tell application "Evernote" set statements to find notes ("tag:FileThis") repeat with statement in statements set att to attachment 1 of statement set fname to filename of att set datestring to find text "[0-9]{4}-[0-9]{2}-[0-9]{2}" in fname with regexp and string result set yyyy to text 1 thru 4 of datestring set mm to text 6 thru 7 of datestring set dd to text 9 thru 10 of datestring set new_date to my date (mm & "/" & dd & "/" & yyyy & " 12:00:00 AM" as string) set creation date of statement to new_date set modification date of statement to new_date end repeatend tellSave into a file (e.g., EN-filethis-fixdate.applescript) and then it can be run from the terminal like so: osascript EN-filethis-fixdate.applescriptThis will update the information directly in your local application, which will then be synced to the cloud and across all of your devices. And your list ordering will be sane again, and your OCD can rest.