CaseLeaf

Handbook / The `answers` command

The answers command

Forty suppliers returned the same questionnaire and you need to see what one of them actually put in each box.

Reads the values out of a filled form, as field name and answer. It is the reading half of filling a form in: fillform writes answers in, this takes them out again. Reach for it to collect what somebody returned, to check a submission before filing it, or to turn a folder of returned copies into one table with gather.

How you run it

caseleaf answers report.pdf

caseleaf answers report.pdf --to path.csv

What each part means

In full, every part it will take:

caseleaf answers <file> [--to <path.csv>]
part what it is for
<file> The PDF to work on, as a path, such as report.pdf beside you, or the full path to it. It is read and not written.
--to Where to write the answers, as a path ending .csv, such as returned.csv. Two columns under a field,value heading, one row per field. Left out, they are printed instead.

As two columns, to the given path, or to stdout as JSON.

What comes back

Asked of a short sample document, it answers as below. The sample has eight sheets, a highlight and a note left by a reviewer, a web link, a small table, two pictures and one form field already filled in.

{
  "answers" : [
    {
      "field" : "party_name",
      "value" : "Acme Holdings"
    }
  ],
  "count" : 1
}

The same thing from AppleScript

Everything above can be asked for from a script instead. There is one AppleScript command, perform: on names the document, and options takes the rest exactly as you would type it.

tell application "CaseLeaf"
    perform "answers" on "/path/to/report.pdf"
end tell

tell application "CaseLeaf"
    perform "answers" on "/path/to/report.pdf" ¬
        options "--to path.csv"
end tell

All the commands · Asking from a script · Contents