CaseLeaf

Handbook / The `read` command

The read command

A script has to decide what to do with a document it has just been handed, and needs everything the file knows about itself.

Prints everything the document records in one answer: its marks, its history, its bookmarks, its snapshots, its identity, its name and how many sheets it has. It is what a script asks when it is going to decide what to do next, and the one to reach for when you do not yet know which narrower question you want. When you know, the narrower one is easier to read.

How you run it

caseleaf read report.pdf

What each part means

In full, every part it will take:

caseleaf read <file>

The document, and nothing else.

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.

{
  "bookmarks" : [

  ],
  "file" : "report.pdf",
  "history" : [

  ],
  … and the rest of the answer

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 "read" on "/path/to/report.pdf"
end tell

All the commands · Asking from a script · Contents