Automate to save mental energy, not time
Automation doesn't always save as much time or effort as we expect.
The xkcd cartoon above is looking at automation as an investment. Does the work I put in now eventually save more work than I put into it? Automation may be well worth it even if the answer is "no."
Automation can be like a battery as well as an investment. Putting energy into batteries is a bad investment; you'll never get out as much energy as you put in. But that's not why you put energy into batteries. You put energy in while you can so you can use some of that energy later when you need it.
Write automation scripts when you have the time, energy, and motivation to do so and when nothing else is more important. (Or nothing is more interesting, if you're looking for a way to procrastinate without feeling too guilty. This is called "moral compensation.") You may indeed save more work than you put into writing the scripts. But you also may save mental energy just when you need it.
Suppose it takes you an hour to write a script that only saves you two minutes later. If that two minutes would have derailed your concentration at a critical moment, but it didn't because you had the script, writing the script may have paid for itself, even though you invested 60 minutes to save 2 minutes.
If your goal is to save mental energy, not time, you have a different strategy for automation. If a script executes faster than a manual process, but it takes a long time to remember where to find the script and how to run it, it may be a net loss. The less often you run a script, the chattier the interface should be.
The same considerations apply to learning third party software. I suspect the time I've put into learning some features of Emacs, for example, will not pay for itself in terms of time invested versus time saved. But I've invested leisure time to save time when I'm working hard, not to save keystrokes but to save mental energy for the project at hand.
Related post: How much does typing speed matter?