During the past couple of days I started to pimp my wife’s workflow with DEVONthink Pro using AppleScript, which I sort of learn as I go along. Always nice to let other applications doing the heavy lifting while I only glue things together
In a group I create some records for contacts, invoice numbers and case numbers (she is a lawyer, that’s why). The contacts are all just simple text files with distinct names and the contact’s id (from the Contacts macOS application) in it. Like this:
set theRecord to create record with {name:einTyp, source:dieID, type:text} in theGroup
If for some reason I need to change the content of the file I delete the record and create a new one. Is there a method to update the source of a record?
I just hit a brick wall. I started this stuff five days ago and on my Mac it works. Unfortunately, I haven’t been able to figure out AppleScript’s paths. My functions - I guess they are called handlers in AppleScripts - are in the same folder as the main scripts, which happen to be a folder in the users home directory. If I replace the full path ( like /Users/username/ with the ~-sign AppleScript won’t load the handler file, complaining about ‘cannot change to type file’. Do I have to tweak every file on its own or is there some way to substitute the respective users home folder in the load script directive?
Paths in AppleScript are fiddly things, as their are POSIX paths and HFS paths. Which one to use and how it behaves can also be dependent on the application you’re talking to.
Thank you very much. But “fiddly” might be some understatement. For one part I will need a more versatile UI so today I started looking into AppleScriptObjC and guess what - it gets even fiddlier (if that is even a word). Still, it beats trying to write everything from scratch by a considerable margin, and it’s way easier to learn.
Actually, once you get into AppleScript, you should realize it’s quite simple to learn and incredibly powerful! The idiosyncracies with different applications are no different than learning dialects in language.