My partner and I have over 10 credit cards statements in pdf format, downloaded each month.
Hazel is able to sort them into specific folders for each of us, pull the date of statement as well as payment due date and the last 4digits of the card, example:
2015-04DUE-20Apr-X9573.pdf
Is there a way to use applescript and hazel to automatically create an OmniFocus task
with the due date grabbed from the file’s name and the last 4digits as the title?
Here’s a place to start. You’d need the Applescript to set the due date, something I’m not sure it can do, but I bet there’s a way…
http://patricklenz.co/blog/2012/9/1/create-omnifocus-tasks-via-hazel-redux
That’s a good starting point, thanks!
Hope there’s a solution for the due date :)
You can definitely set the due date via Applescript. It’s really just a matter of putting the date into a variable like “theduedate” and then including a line like the following:
set due date of newtask to theduedate
Parsing the date out of the filename is a different story, of course, but should still be possible via Applescript, but would definitely be a bit trickier to do. You can probably find routines online that will parse dates out of filenames via Finder. To get your started, here’s a “parsedate” routine that I use in Applescript to turn a “YYYY-MM-DD” string found after a comma into a standard date (I use this with filenames of the format “Statement, 2015-01-01” to set creation dates in Evernote, so it’s a similar concept).
on parsedate(a_note)
if (offset of "," in a_note) is 0 then
return 0
end if
set textdate to text ((offset of "," in a_note) + 2) thru (length of a_note) of a_note
set AppleScript's text item delimiters to {"-"}
set y to text item 1 of textdate
set m to text item 2 of textdate
set d to text item 3 of textdate
set realdate to current date
set year of realdate to y
set month of realdate to m
set day of realdate to d
set hours of realdate to "0"
set minutes of realdate to "0"
set seconds of realdate to "0"
return realdate
end parsedate
Here’s the solution 👉 https://mariuszspychala.com/finance-part-one/
Would be very interested in seeing your script. The picture of the script on your blog post is cropped. Have a similar situation that this script might solve - thx
Thanks @ckpiv . The script looks cropped but you can scroll to the right.
You should be able to copy it easily. It’s not an image :)
Thanks @mario. I was viewing the thread on my iPad last night and for some reason it was not scrolling. Checked on my computer this morning and It does indeed scroll and on iPad after reboot. Thanks for the thread and blog post.
No problem! :)