Help Request with AppleScript, Reminders, & DevonThink

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Im looking for a hazel workflow that can

1) automatically import a bill/statement into DevonThink, and
2) automatically add a new reminder to the REMINDERS APP that contains a link to the file within the DevonThink database.

I'm nearly there, as I have Part 1 figured out, but could use a little help, with the 2nd task, as I'm a relative newbie with applescript.

A little background :

I have a workflow that automatically downloads my latest statements from FileThis, and sorts them into a catch-all FINDER folder that sorts my new statements into FINDER subfolders (ie - Chase, AmEx, Bank of America, ...etc).

I tend to migrate all of my records into DevonThink Office to organize my paperless office, so I've built a successful a workflow that imports these statements into designated folders into DevonThink, which works flawlessly:

Code: Select all
tell application "Finder"
   set _path to (the POSIX path of theFile as string)
   set {_name, _extension} to {name, name extension} of theFile
   -- optional: remove extension for DEVONthink displays
   set _name to text 1 thru -((count _extension) + 2) of _name
   set _extension to "." & _extension
end tell

-- Launch DEVONthink if it isn't already open.
tell application "System Events"
   if not (exists process "DEVONthink Pro Office") then
      tell application id "com.devon-technologies.thinkpro2" to activate
   end if
end tell

-- Import the file.

tell application id "com.devon-technologies.thinkpro2"
   set theGroup to get record with uuid "<DEVONTHINK-FOLDER-ID>"
   
   -- choose one option, Index or Import, comment out the other
   set theImport to import _path name _name to theGroup
   -- set theIndex to indicate _path to theGroup
end tell



Now, this is where Im struggling. I want to create a reminder to RECONCILE STATEMENT, once the file has been downloaded from filethis.com and sorted by hazel.

Ive been playing with another applescript that can set a reminder when it detects a new statement in my catch-all FINDER folder, but the problem I'm having - is that I do not know how to code the embedded applescript to either

    1) include a link (within the reminder) to the statement pdf in the catch-all FINDER folder -OR-

    2) preferably - include a link to the file AFTER it is placed within the DevonThink database. Below is the current test applescript Ive setup to create a very basic reminder when hazel detects a new statement in the catch all FINDER folder, but it does not yet include a link to the filepath, or a reference to the filename. I would preferably like to do both:


Code: Select all
set myList to "Finances"
set myName to "Reconcile AmEx Statement"
set DueDate to (current date) + (2 * weeks)

# Build the body of the reminder with Issue and Due Dates
set myBody to "New Bill added to DevonThink" as string

# Build the reminder
tell application "Reminders"
   set newremin to make new reminder in list myList
   set name of newremin to myName
   set body of newremin to myBody
   set remind me date of newremin to DueDate
   
end tell

I understand not everyone here is familiar with DevonThink, but if anyone here can provide at least a way to include applescript reference to the filename, or a filepath link to within a traditional FINDER environment, this will be a great first step for me.

Thanks!
noodle-nomad
 
Posts: 1
Joined: Tue Jul 25, 2017 6:53 pm

Return to Support

cron