CaseLeaf

Handbook / The `workflow` command

The workflow command

Every document of one kind gets the same five steps done to it, and doing them by hand in order is where mistakes come from.

Runs a named sequence of operations over a document. It exists because the same few steps get done to every document of a kind, and typing them in order every time is where mistakes come from. A workflow is that sequence, named, so it can be asked for as one thing and be the same every time.

Three are built in. read-and-file recognises the text on a scan and then records in the history that it was read; take-pages lifts sheets out into a document of their own and notes in the original that they went; marked-diff compares this document with another and keeps the comparison as a document. Ask one what it needs with caseleaf workflow --name <workflow> --help, and a sequence short of an argument refuses before any of its steps run.

How you run it

caseleaf workflow report.pdf --name read-and-file

caseleaf workflow report.pdf --name read-and-file --to reviewed.pdf

What each part means

In full, every part it will take:

caseleaf workflow <file> --name <workflow> [--to <output>] [...]
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. This command writes to it unless you send the result somewhere else with --to.
--name Which sequence to run: read-and-file, take-pages or marked-diff. Each is listed below with what it asks for.
--to Where the document the sequence ends with is written. Left out, the sequence's own last step decides.

read-and-file

caseleaf workflow <file> --name read-and-file [--to <output>]
Steps:
1. ocr
2. note

take-pages

caseleaf workflow <file> --name take-pages --pages 2[,3] [--to <output>]
Arguments:
--pages  Which pages to lift out, separated by commas.
Steps:
1. pages
2. note  (on the original)

marked-diff

caseleaf workflow <file> --name marked-diff --against <other.pdf> [--to <output>]
Arguments:
--against  The document to compare this one with.
Steps:
1. diff
2. share

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.

{
  "ended" : "report.pdf",
  "said" : [
    {
      "pages" : 0,
      "written" : false
    },
    {
      "entries" : 1,
      "written" : true
    }
  ],
  "steps" : 2,
  "workflow" : "read-and-file"
}

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 "workflow" on "/path/to/report.pdf" ¬
        options "--name read-and-file"
end tell

tell application "CaseLeaf"
    perform "workflow" on "/path/to/report.pdf" ¬
        options "--name read-and-file --to reviewed.pdf"
end tell

All the commands · Asking from a script · Contents