9 Automating tedious tasks

 

This chapter covers

  • Understanding why programmers write tools
  • Determining which modules we need to write a given tool
  • Automating cleaning up emails that have > > > symbols
  • Automating manipulating PDF files
  • Automating removing duplicate pictures across multiple image libraries

Suppose that you’re responsible for creating 100 reports, one for each of 100 people. Perhaps you’re a teacher and need to send a report to each of your students. Perhaps you work for HR and need to send an annual assessment report to each employee. Regardless of your role, you have the problem of having to create these reports, and you decided to prepare your reports as .pdf files. You need a customized cover page for each report too, and those cover pages are designed by one of your colleagues (a graphic design artist).

You and your colleague work independently, and, finally, the job is done. Or wait, not so fast. Because now you have to put each cover page at the beginning of each report.

At this point, a nonprogrammer might grit their teeth and start on the job, manually merging the cover page with the first report, the second cover page with the second report, and so on. That could take hours. Not knowing that there may be another way, a nonprogrammer may just power ahead until the job is done.

But you’re a programmer now. And most programmers, the two of us included, would never power ahead with manual work like this.

9.1 Why programmers make tools

9.2 How to use Copilot to write tools

9.3 Example 1: Cleaning up email text

9.3.1 Conversing with Copilot

9.3.2 Writing the tool to clean up email

9.4 Example 2: Adding cover pages to PDF files

9.4.1 Conversing with Copilot

9.4.2 Writing the tool

9.5 Example 3: Merging phone picture libraries

9.5.1 Conversing with Copilot

9.5.2 Top-down design

9.5.3 Writing the tool

9.6 Exercises

Summary