I’m on my third day as a DEVONthink user after the latest Evernote update forced me to find an alternative. Now I have a little problem that is driving me crazy.
I am migrating certain features and workflow from Evernote to DEVONthink and one of them is importing invoices, bank statements and other documents.
My problem is the following, exemplified by an invoice.
The invoice (as a pdf file) is moved to the inbox on the counter, with a name according to “Invoice Storuman Malmön 2020-01-23”.
The first part of the name is the name of the company and the second part is the invoice date.
I have created this Smart Rule to move it to the correct database, add tags and set Creation Date equal to the date from the file name.
I use this script (I think originated from user pete31) to set the Creation Date:
on performSmartRule(theRecords) tell application id "DNtp" try repeat with thisRecord in theRecords set thisName to name without extension of thisRecord set theCreationDate to creation date of thisRecord try set seconds of theCreationDate to 10 set minutes of theCreationDate to 10 set hours of theCreationDate to 10 set day of theCreationDate to ((characters -2 thru -1 in thisName) as string) as integer set month of theCreationDate to ((characters -5 thru -4 in thisName) as string) as integer set year of theCreationDate to ((characters -10 thru -7 in thisName) as string) as integer set creation date of thisRecord to theCreationDate end try end repeat on error error_message number error_number if the error_number is not -128 then display alert "DEVONthink" message error_message as warning end try end tell end performSmartRule
This works well for all files except when the date is the 31st day of the month where the script set the date to the 1st day of the month.
For example the file Invoice Storuman Malmön 2020-01-31 get the date 2020-01-01. See screen copy below.
Anyone who can solve this for me?