CaseLeaf

Handbook / The `attach` command

The attach command

The spreadsheet behind a figure has to travel with the report rather than in a second email that gets separated from it.

Puts a file inside the document. It is how supporting material travels with the thing it supports rather than beside it in an email: the spreadsheet behind a figure, the original of a scan, the correspondence a decision rests on. What is carried is listed by attachments, and it is worth checking before sending a document on.

How you run it

caseleaf attach report.pdf --file reviewed.pdf

caseleaf attach report.pdf --file reviewed.pdf --name "force majeure" --type application/pdf

What each part means

In full, every part it will take:

caseleaf attach <file> --file <path> [--name <text>] [--type <mime>]
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, so keep a copy if the original matters.
--file The file to carry inside, as a path such as schedule-b.xlsx. It is copied in, so the original can be moved or deleted afterwards. attachments lists what a document carries.
--name What to call it. The file's own name if left out. (optional)
--type Its media type. Nothing is guessed from the name: left out, it is recorded as application/octet-stream. (optional)

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.

{
  "attached" : "reviewed.pdf",
  "attachments" : [
    "reviewed.pdf"
  ],
  "bytes" : 90875,
  "objects appended" : 4
}

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 "attach" on "/path/to/report.pdf" ¬
        options "--file reviewed.pdf"
end tell

tell application "CaseLeaf"
    perform "attach" on "/path/to/report.pdf" ¬
        options "--file reviewed.pdf --name \"force majeure\" --type application/pdf"
end tell

All the commands · Asking from a script · Contents