by grandpoobah · 4y ago · 0 comments
function go() {
let line = document.querySelector('#statementLines .line');
if (line) {
let leftAndRight = line.querySelectorAll('.statement');
let left = leftAndRight[0];
let right = leftAndRight[1];
if (right.hasClassName('matched')) {
let leftDetails = left.querySelectorAll('.info .details-container .details span');
let leftDate = leftDetails[0].textContent;
let leftReference = leftDetails[1].textContent;
let rightDetails = right.querySelectorAll('.info .details-container .details span');
let rightDate = rightDetails[0].textContent;
let rightReference = rightDetails[2].textContent;
rightReference = rightReference.replace('Ref: ', '');
if (Date.parse(leftDate).getTime() == Date.parse(rightDate).getTime() && leftReference.toLowerCase() == rightReference.toLowerCase()) {
var okButton = line.querySelector(".ok .okayButton");
console.log(leftReference);
okButton.click();
var waiter = function () {
if (line.parentNode == null) {
go();
}
else {
setTimeout(waiter, 50);
}
};
setTimeout(waiter, 50);
}
else {
console.log("Details dont match");
}
}
else {
console.log("Line not matched");
}
}
else {
console.log("No line found");
}
}setTimeout(go, 100);
There are several different plaintext accounting tools, but they all support automation like this. I personally use Beancount because I work best in Python.
The other huge advantage is that the "state" of your finances isn't opaque like in Xero. If you realize you've been categorizing certain transactions incorrectly in Xero, it's a hassle to navigate Xero's interface to correct everything, whereas in plaintext accounting it's usually a 2-second find/replace.
The downside is that there's a steep learning curve and the documentation is kind of overwhelming, but once you learn it, it's extremely valuable.