Doc kit command
caret.set
Set Caret
Puts the caret at a position (a document position, as file.selection answers) or at a point on a page, optionally extending the selection. With `unit` it selects the word, line, paragraph (with its mark) or paragraph's text (without it) at `pos`; with `extend` too, the selection grows by that unit from the range `start`..`end` (else the anchor), which stays selected.
- Kit
- Doc 0.1.0 (.docx)
- Changes the document
- no
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
end | object | no | where the range the selection grows from ends (with `unit` and `extend`) |
extend | boolean | no | in one of several forms of the parameters |
page | integer | no | in one of several forms of the parameters |
pos | object | no | a position as file.selection answers |
start | object | no | where the range the selection grows from starts (with `unit` and `extend`) |
story | string | object | no | read by the command beside its listed parameters |
unit | "word" | "line" | "paragraph" | "paragraphText" | no | in one of several forms of the parameters |
x | number | no | points; in one of several forms of the parameters |
y | number | no | points; in one of several forms of the parameters |
Call through doc_run
doc_run {
"path": "<file>.docx",
"steps": [{ "command": "caret.set" }]
}The required parameters, with placeholders for their types: not a tested example. Optional: end, extend, page, pos, start, story, unit, x, y. doc_run answers the step’s result in completed[i].result.
Result
| Name | Type | Required | Description |
|---|---|---|---|
anchor | object | no | |
focus | object | no |
Result JSON Schema
{
"additionalProperties": true,
"properties": {
"anchor": {
"additionalProperties": true,
"properties": {
"off": {
"type": "number"
},
"path": {
"items": {
"type": "number"
},
"type": "array"
},
"story": {
"type": "string"
}
},
"type": "object"
},
"focus": {
"additionalProperties": true,
"properties": {
"off": {
"type": "number"
},
"path": {
"items": {
"type": "number"
},
"type": "array"
},
"story": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}Parameter schema
{
"additionalProperties": false,
"properties": {
"end": {
"additionalProperties": true,
"description": "where the range the selection grows from ends (with `unit` and `extend`)",
"properties": {
"off": {
"description": "character offset in the paragraph",
"type": "integer"
},
"path": {
"description": "paragraph path counted from 0",
"items": {
"type": "integer"
},
"type": "array"
},
"story": {
"description": "\"body\", or {\"part\": n} for a header, footer, note, comment or text box story",
"oneOf": [
{
"enum": [
"body"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"part": {
"description": "header, footer, footnote, endnote, comment or text box story number",
"type": "integer"
}
},
"type": "object"
}
]
}
},
"type": "object"
},
"extend": {
"description": "in one of several forms of the parameters",
"type": "boolean"
},
"page": {
"description": "in one of several forms of the parameters",
"type": "integer"
},
"pos": {
"additionalProperties": true,
"description": "a position as file.selection answers",
"properties": {
"off": {
"description": "character offset in the paragraph",
"type": "integer"
},
"path": {
"description": "paragraph path counted from 0",
"items": {
"type": "integer"
},
"type": "array"
},
"story": {
"description": "\"body\", or {\"part\": n} for a header, footer, note, comment or text box story",
"oneOf": [
{
"enum": [
"body"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"part": {
"description": "header, footer, footnote, endnote, comment or text box story number",
"type": "integer"
}
},
"type": "object"
}
]
}
},
"type": "object"
},
"start": {
"additionalProperties": true,
"description": "where the range the selection grows from starts (with `unit` and `extend`)",
"properties": {
"off": {
"description": "character offset in the paragraph",
"type": "integer"
},
"path": {
"description": "paragraph path counted from 0",
"items": {
"type": "integer"
},
"type": "array"
},
"story": {
"description": "\"body\", or {\"part\": n} for a header, footer, note, comment or text box story",
"oneOf": [
{
"enum": [
"body"
],
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"part": {
"description": "header, footer, footnote, endnote, comment or text box story number",
"type": "integer"
}
},
"type": "object"
}
]
}
},
"type": "object"
},
"story": {
"description": "read by the command beside its listed parameters",
"oneOf": [
{
"type": "string"
},
{
"additionalProperties": true,
"type": "object"
}
]
},
"unit": {
"description": "in one of several forms of the parameters",
"enum": [
"word",
"line",
"paragraph",
"paragraphText"
],
"type": "string"
},
"x": {
"description": "points; in one of several forms of the parameters",
"type": "number"
},
"y": {
"description": "points; in one of several forms of the parameters",
"type": "number"
}
},
"type": "object"
}Generated from the command list of @kition/[email protected] and the kit itself (doc_commands through @kition/[email protected], built from KitionAI/kition-doc@41e14a8). As data: commands.jsonl.