Well, the books are probably mostly out of print. You might want to have a look at the O’Reilly website for that. Then there’s the MacScripter website for code samples.
Though I don’t understand the fixation on AppleScript. If you don’t know anything about programming, why start with that instead of a modern language? JavaScript can be used for your task equally well, it can handle JSON out of the box, and it is better suited to deal with strings, etc. Not to mention that the web is full of information on it; there are even books out there, all that.
Case in point: (All that can be achieved in AppleScript, too. The ibanMatch part might be a bit harder, though).
const matchAccounts = {'AAA': 'DE12…', 'BBB': 'DE34…', 'CCC': 'DE56…'};
const app = Application('DEVONthink');
const records = app.selectedRecords();
records.forEach(r => {
const code = r.name().substring(0,2);
const account = matchAccounts[code];
if (!account) {
throw new Error(`No account found for code ${code} in record ${r.name()}`);
}
const txt = r.plainText();
// get recipient from text
const ibanMatch = txt.match(/[A-Z][A-Z][0-9\s]{20,25}/);
if (!ibanMatch) {
throw new Error(`No IBAN found in record ${r.name()}`);
};
// get amount – that's the hardest part in my experience
})
This sample script (untested) would loop over the currently selected records and use the first three letters of the filename to find the corresponding account defined in the object matchAccounts. It bails out if no match exists.
The code then looks at the text of the record to find the IBAN (again bailing out if none is found). The two remaining parts, finding the recipient and the amount, are more difficult.
If the three-letter code is tied to certain recipients, you can add code to get the amount and the recipient depending on this code. I wrote a sample ages ago.
Edit I just fiddled around with DT’s documentAmount, which is supposedly finding the amount in a document. I ran that on a bit more than 600 documents, and the results were … mixed. In some cases, DT didn’t find anything. In others, it found the correct value. In others, it found e.g. the value without VAT (not helpful). And in others it found a completely bogus value. In my opinion, your safest bet is to tailor functions to get the amount depending on the sender of the invoice.
Simplistic approaches like “take the maximum value” or “take the last amount” will reliably fail: there might be a discount applied to the maximum value or the last amount on the invoice might be the cost of labour (
Getting the information from the PDFs is the hard part. Feeding them to MoneyMoney is simple.