CaseLeaf

Handbook / The command

The command

Everything this application can be asked to do, it can be asked from a terminal. The command is caseleaf, and it works on files without opening a window. It lives inside the application, at Contents/Helpers/caseleaf; link it once from somewhere on your path, such as /usr/local/bin, and it follows every update of the application from then on.

caseleaf marks report.pdf
caseleaf find report.pdf --for "indemnity"
caseleaf blackout report.pdf --page 4 --bounds 72,500,300,40

caseleaf on its own lists every command. caseleaf <command> --help says what one takes and what it does.

Why it exists

The window and the command are two ways of asking for the same things. A command is not a second implementation of a feature. It is the same operation the menu item calls, reached from somewhere else. So the two cannot drift: a change to what Black Out Permanently… does changes caseleaf redact at the same time.

The command matters when the work is not one document. A hundred contracts to check for a phrase, a folder of scans to recognise, a nightly job that marks whatever arrived that day: none of those should be done by hand, and none of them need a window.

What it can be asked

There are more commands than anyone holds in their head, so the table below is grouped rather than alphabetical. The groups are the application's own, the same ones caseleaf prints when you give it nothing to do.

Nothing in the first group can damage the document it is given, however wrong the arguments are. Most of them only read it. The three that produce anything (smaller, reveal, docx) write a new file where you say and leave the original alone. Everything in the second group either changes the document it is given or makes a new one beside it; each command's page says which, on the line describing the document itself. The third group matters only when a document is going to somebody who must not be able to recover what was taken out of it.

Each row gives the word and the single line the command prints beside it. The last column says whether the same command can also be asked for from AppleScript, which all of them can. Asking from AppleScript says how that is written.

The table leaves out what each command takes. The arguments differ from command to command, several commands accept more than one shape, and the command itself is the only place that cannot be out of date about them. So ask it: caseleaf <command> --help prints the syntax, every argument with a line about it, and whatever else you need to know before you run it.

Every command

These commands read a document and change nothing in it. Reach for them to ask a question of a file, or to write a copy that leaves the original alone.

command what it does from AppleScript more
access what a screen reader cannot make sense of yes access
anchors the recordings tied to its marks yes anchors
answers what its form holds yes answers
attachments the files carried inside it yes attachments
boxes rectangles drawn on a sheet, as the system sees them yes boxes
identifiers what in it would stop it being anonymous yes identifiers
links what it points at, and where each link goes yes links
fields the form fields it would propose yes fields
find where a phrase appears, with the line it is in yes find
furniture which margin bands read-aloud would leave out yes furniture
history the record of what was done to it, and nothing else yes history
inventory everything it carries, or what a copy lost yes inventory
marks the marks on it, with what they say yes marks
pictures every picture in a document, or on one page, and how fine each is yes pictures
smaller a copy whose pictures are no finer than you ask yes smaller
reveal put back a picture written at no opacity yes reveal
docx a Word document that looks like this one yes docx
tags the tags its marks carry, and what carries each yes tags
read everything the document records yes read
redactions what has been blacked out, and by whom yes redactions
tables table cells a sheet appears to hold, as the system reads them yes tables
words where each word sits, and which are misplaced yes words
similar which pages are near-duplicates of one another yes similar

These commands change the document they are given, or write a new one beside it. Each command's page says which.

command what it does from AppleScript more
anchor tie a mark to a moment in a recording yes anchor
attach put a file inside the document yes attach
bookmark keep a page, to come back to yes bookmark
comment comment on one mark yes comment
source which piece of the page's own drawing put ink at a point yes source
talk put a mark up for discussion, or take it back yes talk
reply answer a mark, as a reviewer would yes reply
crop a copy cropped to a rectangle yes crop
cue play the recording from where a mark was discussed yes cue
diff what changed between two documents yes diff
extract a rectangle, or a closed shape, lifted out into its own document yes extract
fillform the same document with answers filled in yes fillform
watermark put a watermark on every page, or take it off yes watermark
export the marks as an archive somebody else can read yes export
flatten every mark burnt into the page yes flatten
gather many filled copies as one table yes gather
import marks brought in from elsewhere yes import
makeform the same page with fields written into it yes makeform
picturefix crop or straighten a picture on a sheet yes picturefix
readpictures read the words in the pictures on a sheet yes readpictures
picture put a picture on a sheet yes picture
mark draw a mark yes mark
measure how long a rectangle is in real units, once a scale is known yes measure
note add one line to the history yes note
identity the document's permanent id, and give it one if it has none yes identity
ocr recognise the text on any page that has none yes ocr
pages add, remove or move pages yes pages
rename give the document another name, or another folder yes rename
restyle a copy whose form fields are drawn with the outline and fill you name yes restyle
retype change the words under a rectangle, in the page's own font yes retype
saveas the document, or the sheets you pick, written in another format yes saveas
share a copy carrying only the marks put up for review yes share
svg a page as an outline drawing yes svg
table a table read off a page yes table
transfer marks brought across from another document yes transfer
unmark remove one mark yes unmark
vectorise glyphs turned into outlines yes vectorise
writefields fields written in, given rather than detected yes writefields
rotate turn sheets a quarter, a half or three quarters yes rotate
flip turn sheets over, left to right or top to bottom yes flip
resize sheets drawn again at another size yes resize

These two matter only when a document is going to somebody who must not be able to recover what was taken out of it.

command what it does from AppleScript more
blackout remove what is under a mark, permanently yes blackout
redact the same, over a whole document yes redact

This one runs several operations as a single request.

command what it does from AppleScript more
workflow run a named sequence of operations over a document yes workflow

Two things to know before you script it

A rectangle can be written either way. 367;584;2783;1036 is x, y, width and height in page points counted up from the bottom left, as PDF does. 2783x1036+367+584 is the X geometry convention, counted from the left and the top, and -x-y measures from the right and the bottom instead. Both are accepted everywhere a rectangle is asked for.

--page counts sheets, from 1, in the order they sit in the file. It is not the number printed on the page. The window's page field is the other way round: there you type the printed folio, and #12 to mean the twelfth sheet. So a rectangle worked out on screen and then handed to the command can land on a different sheet in any book whose numbering does not start at its first leaf.

Watch: a short video for this page is still to come.


Asking from AppleScript · Contents