The Real Reason To ‘Learn To Code’? Automating Your Life
On the joys of writing scripts that do scut work
Last night I automated the tip of my index finger.
I was getting super annoyed by an infinite-scrolling site. I generally hate those: I’m a journalist, and every so often I’m a) doing research that b) requires me to go back several weeks, months or years on c) an infinite-scrolling site. So I have to sit there hitting “page down” or “end” over and over again.
Last night I had to do that at a couple of sites, and after a few minutes I got bored and decided: Screw it, I’m gonna automate this.
So I wrote a quick, tiny script using the programming language Python. The script does one simple thing: It hits the “end” button on my keyboard, waits two seconds, then hits it again. Here’s what it looks like …
Utterly simple! But it did the job. I started it running, flipped over to the site I was reading, and let the script hit “end” over and over, paging downwards and downwards, while I, like, mixed myself a cocktail. When I came back fifteen minutes later, the script had finally arrived at the bottom of the website.
“Don’t learn to code — Learn to automate”
I’m a very hazy, low-skill hobbyist programmer. I never studied any computer science.
I just learned stuff from online guides. I’d learn just enough to build simple web thingies for myself, or little twitter bots, or automated tools. My code projects are all quite rudimentary, but they help me accomplish some task — something in my job, or my personal life — more easily.
Which brings me to my point here:
Since I write about technology, every so often a friend will ask me — “Hey, should I learn to code?” Or: “Should I try…