Select-Exams.ps1: a script to extract exams from a multi-page PDF

Published
Updated
Source
https://gist.github.com/nidrissi/a802dc0a20ecad0bc8c077ce32b6ad92

With online teaching, I have to find ways to make many processes go faster, as otherwise teaching takes an inordinate amount of time compared to traditional teaching (and my salary doesn’t change…). I have already written about automating exam production I’ve now taken to scanning my students’ exams and grading them directly on my touchscreen computer. This way I avoid all the issues that come with physical exams: I’m not scared to death of bringing them home anymore – losing them means redoing the whole exam 😨, I have a backup, I can give more detailed feedback to students, give it to them earlier and more often, etc.

My department is equipped with one of these huge scanners that can easily chew through dozens of two-sided A3 exam booklets. However, this produces a single huge PDF that contains all the exams. This is easier to grade (I don’t need to switch back and forth between 30+ booklets) but I need to ensure that every student gets their own exam, not everyone’s exam, obviously.

I have thus written a PowerShell script to separate exams and name them automatically so that I can feed them to Moodle. It’s rather simple to use and self-explanatory. It is available on GitHub gist. Note that you need PDFtk to be installed.

Warning

The Moodle participant ID is not the student’s user ID. The participant ID is specific to the course and is more difficult to find. One possibility to find it is to enable offline grading worksheets for the assignment, then to go on the assignment’s page and select the bulk action “Download grading worksheet”. You will obtain a CSV file whose first column will be the participant IDs, of the form Participant12345678. Copy the number (without the prefix Participant) in the CSV file that you give to my script.