CaseLeaf

Handbook / The `identity` command

The identity command

Two copies of the same document have been edited and renamed by different people, and something has to recognise them as the same document.

Reports the document's permanent identity, and gives it one if it has none. It is what lets two copies of a document be recognised as the same document after both have been edited, renamed and passed around. Reach for it at the start of anything that will later need to match copies up.

How you run it

caseleaf identity report.pdf

caseleaf identity report.pdf --mint

What each part means

In full, every part it will take:

caseleaf identity <file> [--mint]
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.
--mint Give the document an identity if it has none. If it already has one the command refuses and changes nothing. An identity is evidence of where a file has been, and this never replaces one. Without --mint the command only reports what is there.

Prints the id already there, or says plainly there is none: null, never an empty string, so a script cannot mistake one for the other. --mint writes an id only when there is none: an id already there, whoever wrote it, is left byte-for-byte alone, and asking to mint over one refuses rather than replacing it.

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.

{
  "identifier" : null,
  "minted" : false
}

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

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

All the commands · Asking from a script · Contents