Script API reference
45 modules, 621 functions. The same module and function names work in JavaScript, Lua and Python. Machine-readable version: /api/script-api.json.
ketec scripts can be written in JavaScript, Python or Lua. The three languages share the same modules, function names and parameter order; Python uses from ketec import action, image, ... (keyword arguments are supported) and some lower-case module names (appleocr, paddleocr, tomatoocr, dotocr, netcard, hotupdate, yolocls); in Lua modules are global tables and object methods use a colon (selector:getOneNodeInfo()). Coordinates for action/hid/image/OCR are screen pixels (see device.getScreenRealSize(), e.g. 1170x2532 on a 3x iPhone); node bounds are logical points. Run modes: Agent mode (developer disk image mounted, Agent connected) synthesizes touches and text on the device and supports node trees and w3cActions; HID mode drives an external ESP32 USB HID device, needs the screen broadcast for screenshots/OCR, and has no node tree or w3cActions. action.* follows the current mode automatically; hid.* always uses the HID device. Relative file paths resolve to the app Documents folder. Each function has a status: stable = works as described; limited = works with the restriction stated in its description; unsupported = present but returns a fixed failure value. Functions marked ketec_extra are ketec additions beyond the common signature set. Defaults shown are those of the current implementation. Many functions also have Chinese-named aliases; this reference lists the English names. JavaScript snippets can be tried with POST /api/runScript on the device HTTP service (default port 9800, e.g. http://phone-ip:9800); the value of the last expression is returned.
action — Touch & input
High-level touch, swipe and text input. Each call is routed by the current run mode: in Agent mode events are synthesized by the on-device Agent; in HID mode they go through the external HID device. Coordinates are screen pixels (e.g. 1170x2532 on a 3x device).
Modes: agent, hid
action.click(x, y, duration?, jitter?)
Taps a point.
x(number): X coordinate (screen pixels)y(number): Y coordinate (screen pixels)duration(number, optional, default 20): Press time in msjitter(boolean, optional, default false): Add random offset (Agent only; ignored in HID mode)- returns
boolean: true on success
action.click(540, 1200);
action.clickRandom(x1, y1, x2, y2, duration?)
Taps a random point inside the rectangle. An invalid rectangle (x2<=x1 or y2<=y1) falls back to the whole screen.
x1(number): Left of the area (pixels)y1(number): Top of the area (pixels)x2(number): Right of the area (pixels)y2(number): Bottom of the area (pixels)duration(number, optional, default 20): Press time in ms- returns
boolean: true on success
action.doubleClick(x, y, duration?, interval?, jitter?)
Double-taps a point.
x(number): X coordinate (screen pixels)y(number): Y coordinate (screen pixels)duration(number, optional, default 20): Press time of each tap (ms)interval(number, optional, default 80): Gap between the two taps (ms)jitter(boolean, optional, default false): Random offset (Agent only)- returns
boolean: true on success
action.doubleClickRandom(x1, y1, x2, y2, duration?, interval?)
Double-taps a random point inside the rectangle (invalid rectangle = whole screen).
x1(number): Left of the area (pixels)y1(number): Top of the area (pixels)x2(number): Right of the area (pixels)y2(number): Bottom of the area (pixels)duration(number, optional, default 20): Press time (ms)interval(number, optional, default 80): Gap between taps (ms)- returns
boolean: true on success
action.swipe(startX, startY, endX, endY, duration?, jitter?, steps?)
Swipes in a straight line. In HID mode jitter and steps are ignored.
startX(number): Start X (pixels)startY(number): Start Y (pixels)endX(number): End X (pixels)endY(number): End Y (pixels)duration(number, optional, default 300): Swipe time in msjitter(boolean, optional, default false): Randomize the path (Agent only)steps(number, optional, default 0): Intermediate points; 0 = engine default (Agent only)- returns
boolean: true on success
action.swipe(540, 1800, 540, 600, 300);
action.pressAndSwipe(startX, startY, endX, endY, touch_down_duration?, touch_move_duration?)
Long-press then move to the end point. HID mode: real press-drag-release. Agent mode: a long press followed by a separate swipe (finger is lifted in between), so it may not drag items; use action.drag for a held drag. Extra parameters from the signature table (touch_up_duration, jitter, steps) are ignored. [limited]
startX(number): Start XstartY(number): Start YendX(number): End XendY(number): End Ytouch_down_duration(number, optional, default 500): Hold time before moving (ms)touch_move_duration(number, optional, default 300): Move time (ms)- returns
boolean: true on success
action.swipeCurve(startX, startY, midX, midY, endX, endY, duration?)
Swipes through a middle point. Implemented as two straight segments (start→mid, mid→end) by the Agent synthesizer; for a curved HID swipe use hid.swipeCurve. [limited]
startX(number): Start XstartY(number): Start YmidX(number): Middle point XmidY(number): Middle point YendX(number): End XendY(number): End Yduration(number, optional, default 300): Total time (ms)- returns
boolean: true on success
action.input(text, frequency?)
Types text into the focused field. Agent mode types through the Agent (fast); in HID mode with the HID device connected it is sent through HID. If the Agent path fails it falls back to HID.
text(string): Text to type (Unicode supported)frequency(number, optional): Accepted for compatibility; ignored by the current binding- returns
boolean: true on success
action.input('hello 你好');action.inputSimple(text)
Types text key by key (about 15 chars/s in Agent mode). In HID mode, if the ketec keyboard is on screen the text is inserted through it, otherwise sent as HID keystrokes (ASCII only).
text(string): Text, typed key by key- returns
boolean: true on success
action.backspace(count?)
Deletes characters before the cursor.
count(number, optional, default 1): Number of deletions- returns
boolean: true on success
action.enter()
Presses Return.
- returns
boolean: true on success
action.homeScreen()
Goes to the Home Screen. Only works through HID; in Agent mode it returns false. [limited]
- returns
boolean: true on success
action.pressButton(button)
Presses a device/media button through the HID device. Requires a connected HID device in any mode; otherwise returns false. [limited]
button(string): Case-sensitive name: home, volumeup, volumedown, mute, playpause, next, prev, brightnessup, brightnessdown, eject, globe, recent, search, power, snapshot- returns
boolean: true on success
action.sendKey(keys)
Sends a key combination through the HID device. Requires a connected HID device. [limited]
keys(array|number|string): Key combination: key codes (see hidKey), key names such as "COMMAND", or single characters, e.g. [hidKey.COMMAND, "v"]- returns
boolean: true on success
action.sendKey([hidKey.COMMAND, 'a']);
action.w3cActions(json)
Runs a W3C Actions gesture sequence (multi-touch, holds, sequences). Agent mode only; returns false in HID mode or for an empty body.
json(object|string): W3C Actions body {actions:[{type:"pointer", id, parameters:{pointerType:"touch"}, actions:[{type:"pointerMove",x,y,duration},{type:"pointerDown"},{type:"pause",duration},{type:"pointerUp"}]}]}; several pointers = multi-touch- returns
boolean: true on success
action.createBuilder()
Creates a gesture builder. Pointers added in one group run in parallel (pinch/rotate); groups and singleTap/multiTap run in call order. Executes through w3cActions, so Agent mode only.
- returns
ActionBuilder: Builder with addPointer(id?) → PointerBuilder {moveTo(x,y,ms?), down(), up(), stay(ms=20), tap(x,y,ms=20), done()}, singleTap(x,y,ms?), multiTap(points,ms?), execute() → boolean
action.createBuilder().addPointer().moveTo(300,800).down().moveTo(300,400,300).up().done().execute();
action.setJitterValue(value)
Sets the random jitter amplitude for Agent taps/swipes.
value(number): Jitter amplitude used when jitter=true (unit not documented, presumably pixels) [unverified]- returns
undefined: No return value
action.getRunMode()
Returns the current run mode.
- returns
string: "agent" or "hid"
action.longPress(x, y, duration?)
Long-presses a point and returns after the hold time.
x(number): X coordinate (screen pixels)y(number): Y coordinate (screen pixels)duration(number, optional, default 500): Hold time in ms (HID mode uses at least 600)- returns
boolean: true on success
action.drag(x1, y1, x2, y2, duration?)
Press-hold-drag with the finger kept down. Agent mode only (returns false in HID mode).
x1(number): Start Xy1(number): Start Yx2(number): End Xy2(number): End Yduration(number, optional, default 1200): Drag time (ms)- returns
boolean: true on success
action.findText(text, options?)
Screenshots and OCRs the screen, returning the best match for the text.
text(string): Text to find on screenoptions(object, optional): {exact: boolean}- returns
object: {ok, text, confidence, cx, cy, candidates[], recognizedCount, reason?}; cx/cy are screen pixels
action.clickText(text, options?)
Finds text on screen with OCR and taps its center.
text(string): Text to find and tapoptions(object, optional): {exact: boolean, index: number (which candidate)}- returns
object: findText result plus tapped, clickedText, clickedPoint
node — UI element tree
Find and operate UI elements of the foreground app via the accessibility snapshot. Entry point: createNodeSelector(). Requires Agent mode (developer image mounted, Agent connected). NodeInfo.bounds are in logical points (multiply by device.getScreenScale() before passing to action.click); NodeInfo action methods convert automatically.
Modes: agent
createNodeSelector(params?)
Creates a node selector. Add conditions (all must match), then call getNodeInfo / getOneNodeInfo.
params(object, optional): {maxDepth=50, mode=1, bundleId?, pid?}. mode: 1 = one snapshot of the whole tree (22 attributes, the default, fastest and most stable); 2 = stitched, 2 levels per request (13 attributes), every cut-off node is requested again and attached in place, for long lists and deep trees, slower; 3 = stitched, 1 level per request (13 attributes, at most 256 children per level). Same modes as GET /api/source?mode=. Also available as node.createNodeSelector in Python/Lua- returns
Selector: A new selector
var n = createNodeSelector().label('Settings').getOneNodeInfo(3000); if (n) n.tap();selector.label(value)
Matches label exactly.
value(string): Label text- returns
Selector: The same selector (chainable)
selector.labelMatch(pattern)
Matches label with a regular expression.
pattern(string): Regular expression- returns
Selector: The same selector (chainable)
selector.title(value)
Matches title exactly.
value(string): Title- returns
Selector: The same selector (chainable)
selector.titleMatch(pattern)
Matches title with a regular expression.
pattern(string): Regular expression- returns
Selector: The same selector (chainable)
selector.identifier(value)
Matches accessibility identifier exactly.
value(string): Identifier- returns
Selector: The same selector (chainable)
selector.identifierMatch(pattern)
Matches identifier with a regular expression.
pattern(string): Regular expression- returns
Selector: The same selector (chainable)
selector.value(value)
Matches value exactly.
value(string): Value- returns
Selector: The same selector (chainable)
selector.valueMatch(pattern)
Matches value with a regular expression.
pattern(string): Regular expression- returns
Selector: The same selector (chainable)
selector.placeholderValue(value)
Matches placeholder text exactly.
value(string): Placeholder- returns
Selector: The same selector (chainable)
selector.placeholderValueMatch(pattern)
Matches placeholder with a regular expression.
pattern(string): Regular expression- returns
Selector: The same selector (chainable)
selector.type(value)
Matches element type; use the full name, e.g. "XCUIElementTypeButton".
value(string): Full type name- returns
Selector: The same selector (chainable)
selector.typeMatch(pattern)
Matches type with a regular expression.
pattern(string): Regular expression- returns
Selector: The same selector (chainable)
selector.enabled(flag)
Matches enabled state.
flag(boolean): Enabled state- returns
Selector: Chainable
selector.index(n)
Matches sibling index.
n(number): Index among siblings- returns
Selector: Chainable
selector.depth(n)
Matches tree depth.
n(number): Tree depth- returns
Selector: Chainable
selector.childCount(n)
Matches child count.
n(number): Number of children- returns
Selector: Chainable
selector.bounds(x, y, width, height)
Matches by element frame.
x(number): X (points)y(number): Y (points)width(number): Widthheight(number): Height- returns
Selector: Chainable
selector.xpath(expr)
Matches elements by XPath.
expr(string): XPath expression over the element tree XML- returns
Selector: Chainable
selector.id(nodeId)
Matches a node id.
nodeId(string): Node id (index path such as "0/0/1")- returns
Selector: Chainable
selector.getNodeInfo(timeout?)
Returns all matching nodes.
timeout(number, optional, default 5000): Max wait in ms- returns
NodeInfo[]: All matching nodes (may be empty)
selector.getOneNodeInfo(timeout?)
Returns the first matching node.
timeout(number, optional, default 5000): Max wait in ms- returns
NodeInfo|undefined: First match or undefined
selector.loadNode(timeout?)
Forces a fresh snapshot of the element tree.
timeout(number, optional, default 5000): Max wait in ms- returns
boolean: true on success
selector.releaseNode()
Releases the cached tree.
- returns
boolean: true on success
selector.clearSelector()
Clears all conditions.
- returns
Selector: Chainable
selector.xml(timeout?)
Returns the whole element tree as XML.
timeout(number, optional): Max wait in ms- returns
string|undefined: Element tree as XML
node.id / label / type / value / title / identifier / placeholderValue / enabled / bounds / depth / index / parentId / childCount
Plain data properties of a NodeInfo.
- returns
various: bounds = {x, y, width, height, centerX, centerY} in logical points
node.tap()
Taps the element.
- returns
boolean: true on success
node.doubleTap()
Double-taps the element.
- returns
boolean: true on success
node.press(duration?)
Long-presses the element.
duration(number, optional, default 500): Hold time (ms)- returns
boolean: true on success
node.clickCenter()
Taps the element center.
- returns
boolean: true on success
node.clickRandom()
Taps a random point inside the element.
- returns
boolean: true on success
node.hittable()
Whether the element can receive a tap.
- returns
boolean: true on success
node.scrollToVisible()
Scrolls until the element is visible.
- returns
boolean: true on success
node.input(text)
Focuses the element and types text.
text(string): Text to type- returns
boolean: true on success
node.clearInput()
Clears the text field.
- returns
boolean: true on success
node.setValue(text)
Sets the element value.
text(string): New value- returns
boolean: true on success
node.parent() / child(i) / allChildren() / siblings() / previousSiblings() / nextSiblings()
Tree navigation helpers.
- returns
NodeInfo|NodeInfo[]: Related nodes from the same snapshot
node.isAvailable()
Whether the element-tree engine is usable now.
- returns
boolean: true on success
node.xml(timeout?)
Shortcut for createNodeSelector().xml().
timeout(number, optional): Max wait (ms)- returns
string|undefined: Tree XML
node.refresh()
Drops the cached tree so the next query re-snapshots.
- returns
boolean: true on success
node.lastError()
Returns the last node error code (e.g. node_unavailable).
- returns
string: Error code of the last node query/action, "" if none
node.lastResult()
Structured receipt of the last node action.
- returns
object: {ok, via, route, error, detail, ...}
image — Screenshots & image matching
Capture the screen and work with images by imageId (string handle). Includes color finding, multi-point color, template matching (OpenCV), cropping, saving and QR/barcode scanning. Coordinates are image pixels; full-screen captures equal screen pixels. In HID mode screenshots come from the screen broadcast, which must be running. Release images you no longer need.
Modes: agent, hid
image.captureScreen(x?, y?, ex?, ey?)
Takes a screenshot, optionally cropped to (x, y)–(ex, ey).
x(number, optional, default 0): Region left (pixels)y(number, optional, default 0): Region topex(number, optional, default 0): Region right; 0 = image edgeey(number, optional, default 0): Region bottom; 0 = image edge- returns
string|undefined: imageId of the screenshot (cropped when a region is given)
var img = image.captureScreen(); /* ... */ image.release(img);
image.captureFullScreen()
Takes a full-screen screenshot.
- returns
string|undefined: New imageId, undefined on failure
image.captureRect(x, y, width, height)
Takes a screenshot of a rectangle given as x, y, width, height.
x(number): Lefty(number): Topwidth(number): Widthheight(number): Height- returns
string|undefined: New imageId, undefined on failure
image.setCaptureImageId(imageId)
Sets the capture source used by captureScreen. Only "screen" produces frames in this build; other sources make captures return undefined. Empty string = no change. [limited]
imageId(string): Capture source name- returns
boolean: true on success
image.captureMat()
Python only: screenshot as an OpenCV/numpy BGR array.
- returns
numpy.ndarray|None: BGR array (H×W×3)
image.readImage(path)
Loads an image file into a new imageId.
path(string): File path (relative = Documents) or http(s) URL- returns
string|undefined: New imageId, undefined on failure
image.readImageMat(path)
Python only: reads an image file as a BGR array.
path(string): File path- returns
numpy.ndarray|None: BGR array
image.imageIdToMat(imageId)
Python only: converts an imageId to a BGR array.
imageId(string): imageId- returns
numpy.ndarray|None: BGR array
image.clip(id, x, y, ex, ey)
Crops an image to a new imageId.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)x(number): Lefty(number): Topex(number): Right (0 = edge)ey(number): Bottom (0 = edge)- returns
string|undefined: New imageId, undefined on failure
image.getSize(id)
Returns image size.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)- returns
object|undefined: {width, height} in pixels
image.toBase64Format(id, format?, q?)
Encodes an image as Base64.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)format(string, optional, default "jpg"): "jpg" or "png"q(number, optional, default 90): JPEG quality 1–100- returns
string|undefined: Base64 string (no data: prefix)
image.base64ToImage(base64data)
Decodes Base64 into a new imageId.
base64data(string): Base64 image data- returns
string|undefined: New imageId, undefined on failure
image.isRelease(id)
Whether an imageId has been released.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)- returns
boolean: true if released
image.release(id)
Releases an image.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)- returns
boolean: true if the image existed
image.releaseAll()
Releases all images.
- returns
boolean: true on success
image.saveTo(id, path)
Saves an image to a file (parent folders are created).
id(string): imageId (also accepts "screen", a file path or an http(s) URL)path(string): Destination; .png saves PNG, otherwise JPEG. Relative = Documents- returns
boolean: true on success
image.rotateImage(id, degree)
Rotates an image by a multiple of 90°.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)degree(number, default 90): Multiples of 90 only- returns
string|undefined: New imageId, undefined on failure
image.cmpColor(id, points, threshold?)
Multi-point color compare at fixed positions.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)points(string): "x|y|#RRGGBB,x|y|#RRGGBB-#offset,..." absolute coordinatesthreshold(number, optional, default 0.9): Similarity 0–1- returns
boolean: true if every point matches
image.findColor(id, color, threshold?, x?, y?, ex?, ey?, limit?, orz?)
Finds pixels of a color in a region.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)color(string): "#RRGGBB", optional offset "#RRGGBB-#101010"; several colors joined with "|"threshold(number, optional, default 0.9): Similarity 0–1x(number, optional, default 0): Region left (pixels)y(number, optional, default 0): Region topex(number, optional, default 0): Region right; 0 = image edgeey(number, optional, default 0): Region bottom; 0 = image edgelimit(number, optional, default 1): Max results (≤5000)orz(number, optional, default 2): Scan direction 1–8 (2 = top-left→bottom-right, row first)- returns
array: [{x, y, centerX, centerY}] in image pixels; [] if none
var pts = image.findColor(img, '#FF3B30', 0.95, 0, 0, 0, 0, 1);
image.findMultiColor(id, firstColor, threshold?, points, x?, y?, ex?, ey?, limit?, orz?)
Multi-point color search: finds anchor positions where all offset points also match.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)firstColor(string): Anchor color "#RRGGBB[-#offset]"threshold(number, optional, default 0.9): Similarity 0–1points(string): "dx|dy|#RRGGBB,..." offsets relative to the anchorx(number, optional, default 0): Region left (pixels)y(number, optional, default 0): Region topex(number, optional, default 0): Region right; 0 = image edgeey(number, optional, default 0): Region bottom; 0 = image edgelimit(number, optional, default 1): Max results (≤5000)orz(number, optional, default 2): Scan direction 1–8 (2 = top-left→bottom-right, row first)- returns
array: [{x, y, centerX, centerY}] in image pixels; [] if none
image.countColor(id, colors, threshold?, x?, y?, ex?, ey?)
Counts pixels matching the color(s).
id(string): imageId (also accepts "screen", a file path or an http(s) URL)colors(string): Color(s), "|"-separatedthreshold(number, optional, default 0.9): Similarity 0–1x(number, optional, default 0): Region left (pixels)y(number, optional, default 0): Region topex(number, optional, default 0): Region right; 0 = image edgeey(number, optional, default 0): Region bottom; 0 = image edge- returns
number: Matching pixel count
image.findImage(id, templateImageId, x?, y?, ex?, ey?, threshold?, limit?, method?, rgb?, options?)
Template matching with OpenCV. Methods 1/3/5 are the reference path; method 99 picks scales differently for limit>1 and method 0 confidence is inlier ratio — use top-1 / position only. Flat (texture-less) templates give meaningless hits.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)templateImageId(string): Template imageId/path; several templates joined with "|"x(number, optional, default 0): Region left (pixels)y(number, optional, default 0): Region topex(number, optional, default 0): Region right; 0 = image edgeey(number, optional, default 0): Region bottom; 0 = image edgethreshold(number, optional, default 0.9): Similarity 0–1limit(number, optional, default 1): Max results (≤5000)method(number, optional, default 5): 1 SQDIFF_NORMED, 3 CCORR_NORMED, 5 CCOEFF_NORMED, 99 multi-scale, 0 SIFTrgb(boolean, optional, default false): Match in color instead of grayscaleoptions(object, optional): {scaleFactors: number[] (method 99), orz}- returns
array: [{index, x, y, width, height, ex, ey, centerX, centerY, confidence, scaleX, scaleY, ...}] sorted by confidence
var r = image.findImage(img, tpl, 0, 0, 0, 0, 0.9, 1); if (r.length) action.click(r[0].centerX, r[0].centerY);
image.findImageEx(id, kjstPath)
Not supported: the template-project file format is not implemented; always returns []. [unsupported]
id(string): imageId (also accepts "screen", a file path or an http(s) URL)kjstPath(string): Template project file- returns
array: Always []
image.pixel(id, x, y)
Reads one pixel color.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)x(number): Xy(number): Y- returns
number|undefined: ARGB integer (0xFFRRGGBB)
image.argb(color)
Converts an ARGB integer to a hex color string.
color(number): ARGB integer from pixel()- returns
string|undefined: "#RRGGBB"
image.binaryzation(id, threshold?)
Black/white thresholding into a new image.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)threshold(number, optional, default 128): Gray threshold 0–255- returns
string|undefined: New imageId, undefined on failure
image.gray(id)
Grayscale copy of an image.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)- returns
string|undefined: New imageId, undefined on failure
image.scanCode(id)
Scans a QR code or barcode in the image.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)- returns
string|undefined: Decoded text
image.drawRect(id, x, y, ex, ey, color?, thickness?)
Draws a rectangle onto the image in place.
id(string): imageId (also accepts "screen", a file path or an http(s) URL)x(number): Lefty(number): Topex(number): Rightey(number): Bottomcolor(string, optional, default "#FF0000"): Stroke colorthickness(number, optional, default 2): Line width (px)- returns
boolean: true on success
appleOcr — Apple Vision OCR
Text recognition with the system Vision framework. No model download needed. The region filters lines that intersect it; returned coordinates are absolute.
Modes: agent, hid
appleOcr.recognizeAbs(input?, x?, y?, ex?, ey?, languages?)
Recognizes all text lines.
input(string, optional, default "screen"): "screen" or an absolute image file path (imageIds are not accepted by appleOcr)x(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomlanguages(string[], optional): Vision language codes; default ["zh-Hans","en-US"]- returns
array: [{text, confidence, x, y, width, height, ex, ey, centerX, centerY}]; "screen" results are in screen pixels
var lines = appleOcr.recognizeAbs('screen');appleOcr.recognizeNumbersAbs(input?, x?, y?, ex?, ey?)
Fast recognition keeping only lines made of digits.
input(string, optional, default "screen"): "screen" or an absolute image file path (imageIds are not accepted by appleOcr)x(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottom- returns
array: [{text, confidence, x, y, width, height, ex, ey, centerX, centerY}]; "screen" results are in screen pixels
appleOcr.findTextAbs(input, texts, x?, y?, ex?, ey?, languages?, exactMatch?)
Recognizes and keeps only lines matching any of the texts.
input(string, optional, default "screen"): "screen" or an absolute image file path (imageIds are not accepted by appleOcr)texts(string[]): Texts to look forx(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomlanguages(string[], optional): Vision language codes; default ["zh-Hans","en-US"]exactMatch(boolean, optional, default false): Whole-line equality instead of "contains"- returns
array: [{text, confidence, x, y, width, height, ex, ey, centerX, centerY}]; "screen" results are in screen pixels
var r = appleOcr.findTextAbs('screen', ['Settings']); if (r.length) action.click(r[0].centerX, r[0].centerY);appleOcr.recognize(input?)
Full-image recognition (shortcut).
input(string, optional, default "screen"): "screen" or an absolute image file path (imageIds are not accepted by appleOcr)- returns
array: [{text, confidence, x, y, width, height, ex, ey, centerX, centerY}]; "screen" results are in screen pixels
appleOcr.findText(input, texts, exactMatch?)
Full-image findTextAbs.
input(string, optional, default "screen"): "screen" or an absolute image file path (imageIds are not accepted by appleOcr)texts(string[]): TextsexactMatch(boolean, optional, default false): Exact- returns
array: [{text, confidence, x, y, width, height, ex, ey, centerX, centerY}]; "screen" results are in screen pixels
appleOcr.recognizeNumbers(input?, x?, y?, ex?, ey?)
Same as recognizeNumbersAbs.
input(string, optional, default "screen"): "screen" or an absolute image file path (imageIds are not accepted by appleOcr)x(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottom- returns
array: [{text, confidence, x, y, width, height, ex, ey, centerX, centerY}]; "screen" results are in screen pixels
paddleOcr — PaddleOCR (on-device)
PP-OCR models running on-device with ncnn, bundled in the app. The default model (ppocr-v6-small) loads automatically on first use. *Abs functions return coordinates in the full image; recognize/findText return coordinates relative to the region.
Modes: agent, hid
paddleOcr.loadModel(modelId, useGpu?)
Loads (or switches to) a bundled model.
modelId(string): "ppocr-v6-small", "ppocr-v6-tiny" or "ppocr-v5"useGpu(boolean, optional, default false): Use GPU- returns
boolean: true on success
paddleOcr.setMaxSideLen(maxSideLen?)
Sets the detection input size.
maxSideLen(number, optional, default 768): Longest side used for detection; ≤0 resets to 768- returns
boolean: true on success
paddleOcr.recognizeAbs(input?, x?, y?, ex?, ey?, confidenceThreshold?)
Recognizes text, absolute coordinates.
input(string, optional, default "screen"): imageId, "screen", file path or URLx(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomconfidenceThreshold(number, optional, default 0.6): Minimum confidence- returns
array: [{text, confidence, x, y, ex, ey, width, height, centerX, centerY, angle, orientation}]
var r = paddleOcr.recognizeAbs('screen');paddleOcr.findTextAbs(input, targetTexts, x?, y?, ex?, ey?, confidenceThreshold?, exactMatch?)
Finds target texts, absolute coordinates.
input(string, optional, default "screen"): imageId, "screen", file path or URLtargetTexts(string|string[]): Text(s) to findx(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomconfidenceThreshold(number, optional, default 0.6): Minimum confidenceexactMatch(boolean, optional, default false): Exact match- returns
array: [{text, confidence, x, y, ex, ey, width, height, centerX, centerY, angle, orientation}]
paddleOcr.free()
Unloads the model.
- returns
undefined: —
paddleOcr.recognize(input?, x?, y?, ex?, ey?, confidenceThreshold?)
Like recognizeAbs but coordinates are relative to the region.
input(string, optional, default "screen"): imageId, "screen", file path or URLx(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomconfidenceThreshold(number, optional, default 0.6): Minimum confidence- returns
array: [{text, confidence, x, y, ex, ey, width, height, centerX, centerY, angle, orientation}]
paddleOcr.findText(input, targetTexts, x?, y?, ex?, ey?, confidenceThreshold?, exactMatch?)
Like findTextAbs with region-relative coordinates.
input(string, optional, default "screen"): imageId, "screen", file path or URLtargetTexts(string|string[]): Text(s)x(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomconfidenceThreshold(number, optional, default 0.6): Minimum confidenceexactMatch(boolean, optional, default false): Exact- returns
array: [{text, confidence, x, y, ex, ey, width, height, centerX, centerY, angle, orientation}]
paddleOcr.loadV5(useGpu?)
Shortcut for loadModel("ppocr-v5").
useGpu(boolean, optional, default false): GPU- returns
boolean: true on success
tomatoOcr — tomatoOcr-compatible OCR
Compatibility interface for scripts written against the tomatoOcr API. ketec does not ship that third-party SDK; the same calls run on the bundled open-source PP-OCRv5/v6 models (ncnn). No license key is required.
Modes: agent, hid
tomatoOcr.initializeWithConfig(mode, licenseData, remark?)
Always succeeds; reports that the built-in open-source engine is used.
mode(string): IgnoredlicenseData(string): Ignored (no license needed)remark(string, optional): Ignored- returns
object: {status:"success", versionName, deviceId:"", expiryTime:"", message}
tomatoOcr.setHttpIntervalTime(value)
No effect (no online licensing)
value(any): No effect (no online licensing)- returns
undefined: —
tomatoOcr.setRecType(value)
Model group: "ch-3.0" (default) / "ch-2.0" / "ch" → PP-OCRv6; "cht" / "japan" → PP-OCRv5; "korean"; "number" (digits only)
value(any): Model group: "ch-3.0" (default) / "ch-2.0" / "ch" → PP-OCRv6; "cht" / "japan" → PP-OCRv5; "korean"; "number" (digits only)- returns
undefined: —
tomatoOcr.setDetBoxType(value)
"rect" (default) or "quad" box output
value(any): "rect" (default) or "quad" box output- returns
undefined: —
tomatoOcr.setDetUnclipRatio(value)
Detection box expansion (default 1.9)
value(any): Detection box expansion (default 1.9)- returns
undefined: —
tomatoOcr.setDetScaleRatio(value)
Detection scale factor (default 1.0)
value(any): Detection scale factor (default 1.0)- returns
undefined: —
tomatoOcr.setRecScoreThreshold(value)
Minimum recognition score (default 0.1)
value(any): Minimum recognition score (default 0.1)- returns
undefined: —
tomatoOcr.setReturnType(value)
"json" (default), "text", "num", or a custom character set to keep
value(any): "json" (default), "text", "num", or a custom character set to keep- returns
undefined: —
tomatoOcr.setBinaryThresh(value)
Binarize before OCR (0–255, 0 = off)
value(any): Binarize before OCR (0–255, 0 = off)- returns
undefined: —
tomatoOcr.setRunMode(value)
Recorded only; a single CPU engine is used
value(any): Recorded only; a single CPU engine is used- returns
undefined: —
tomatoOcr.setFilterColor(filterColor, backgroundColor)
Keeps only pixels of the given colors before OCR.
filterColor(string): Keep-color specbackgroundColor(string): Background color- returns
undefined: —
tomatoOcr.ocrImage(input, type?, x?, y?, ex?, ey?)
Runs OCR and returns a string.
input(string, optional, default "screen"): imageId, "screen", file path or URLtype(number, optional, default 3): 0 detect only, 1/2 recognize, 3 detect+recognizex(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottom- returns
string: JSON array string [{location:[[x,y]×4], score, words}] (coordinates relative to region), or plain text per setReturnType; "" on failure
tomatoOcr.findTapPoint(data)
Looks up a tap point in the last OCR result.
data(string): Text, or '{"text":"OK"}' / '{"texts":[...]}'- returns
string: "[x,y]" center of the first matching line from the last ocrImage, "" if none
tomatoOcr.findTapPoints(data)
All matching tap points from the last OCR result.
data(string): Same as findTapPoint- returns
string: "[[x,y],...]" or ""
tomatoOcr.release()
Unloads the model and clears the last result.
- returns
undefined: —
dotOcr — Dot-matrix font OCR
Recognizes fixed bitmap fonts (game digits, LED text) with a JSON glyph library. Font files must use format "ketec-dot-font" (a compatible third-party format name is also accepted).
Modes: agent, hid
dotOcr.loadFont(fontPath)
Loads a glyph library.
fontPath(string): Font JSON path (relative = Documents; also tries res/)- returns
string|undefined: fontId
dotOcr.free(fontId)
Unloads one font.
fontId(string): Font id- returns
undefined: —
dotOcr.freeAll()
Unloads all fonts.
- returns
undefined: —
dotOcr.recognizeAbs(fontId, input, x?, y?, ex?, ey?, confidenceThreshold?)
Recognizes characters, absolute coordinates.
fontId(string): Font idinput(string, optional, default "screen"): imageId, "screen", file path or URLx(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomconfidenceThreshold(number, optional, default 0.95): Minimum confidence- returns
array: [{text, confidence, x, y, ex, ey, width, height, centerX, centerY}]
dotOcr.findTextAbs(fontId, input, targetTexts, x?, y?, ex?, ey?, confidenceThreshold?, exactMatch?)
Finds target texts.
fontId(string): Font idinput(string, optional, default "screen"): imageId, "screen", file path or URLtargetTexts(string|string[]): Text(s)x(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (ex<=x means whole image)ey(number, optional, default 0): Region bottomconfidenceThreshold(number, optional, default 0.95): Min confidenceexactMatch(boolean, optional, default false): Exact- returns
array: [{text, confidence, x, y, ex, ey, width, height, centerX, centerY}]
app — Apps (ketec helper)
Small ketec helper module for launching/terminating apps and reading the app list. JavaScript (and dynamic lookup) only; the system module offers the same features with the standard names.
Modes: agent, hid
app.list()
Installed apps.
- returns
array: [{appName, bundleIdentifier, bundleVersion, ...}]
app.frontmost()
Foreground app.
- returns
object: {name, bundleId, pid} or {}
app.launch(bundleId)
Launches / brings an app to the front.
bundleId(string): Bundle id- returns
boolean: true on success
app.terminate(bundleId)
Terminates an app (through the Agent).
bundleId(string): Bundle id- returns
boolean: true on success
system — System & apps
App launch/stop, foreground and installed app info, clipboard, URL opening, notifications, lock state, memory and CPU.
Modes: agent, hid
system.startApp(bundle_id)
Launches an app (or brings it to the front).
bundle_id(string): Bundle identifier, e.g. "com.apple.Preferences"- returns
boolean: true on success
system.startApp('com.apple.calculator');system.stopApp(bundle_id)
Terminates an app through the Agent. In HID mode use hid.closeApp, which can close apps with a gesture.
bundle_id(string): Bundle identifier, e.g. "com.apple.Preferences"- returns
boolean: true on success
system.activateApp(bundle_id)
Brings an app to the front (same as startApp).
bundle_id(string): Bundle identifier, e.g. "com.apple.Preferences"- returns
boolean: true on success
system.activateAppInfo()
Current foreground app.
- returns
object|undefined: {name, bundleId, pid}; undefined if unknown
system.foregroundAppInfos()
Foreground app as a list.
- returns
array: [{name, bundleId, pid}] (0 or 1 item)
system.backgroundAppInfos()
Background apps from the process list. The iOS sandbox usually hides other processes, so this is often []. [limited]
- returns
array: [{bundleId, name, pid}]
system.getInstalledAppList()
Installed apps.
- returns
array: [{appName, bundleIdentifier, bundleVersion}]
system.recent()
Not implemented in the script binding (returns undefined). Use hid.recent() in HID mode. [unsupported]
- returns
undefined: Always undefined
system.openURL(url)
Opens a URL from inside ketec. Some schemes (e.g. prefs:) or opening while ketec is in background may not work; in HID mode hid.openURL is more reliable. [limited]
url(string): URL or URL scheme- returns
boolean: true once the request is issued (not a confirmation that it opened)
system.notify(msg, title?, id?)
Posts a local notification (asks for permission the first time; also shown while ketec is in front).
msg(string): Bodytitle(string, optional): Titleid(string, optional): Same id replaces the previous notification- returns
undefined: —
system.setClipboard(text)
Writes the clipboard.
text(string): Text- returns
boolean: true on success
system.getClipboard()
Reads the clipboard.
- returns
string: Clipboard text ("" if empty)
system.isLocked()
Whether the device is locked.
- returns
boolean: true if the screen is locked
system.lock()
Locks the screen via the HID power key. Requires a connected HID device. [limited]
- returns
boolean: true on success
system.unlock()
Wakes the screen via HID (presses Home twice); does not enter a passcode. Requires HID. [limited]
- returns
boolean: true on success
system.getMemoryInfo()
Memory statistics.
- returns
object: {total, available, used, systemUsed, usagePercentage} — MB (system-wide)
system.getUsedMemory()
Used memory (MB, system-wide).
- returns
number: MB
system.getAvailableMemory()
Available memory (MB).
- returns
number: MB
system.getTotalMemory()
Total physical memory (MB).
- returns
number: MB
system.getSystemUsedMemory()
Currently returns the same value as getUsedMemory (the separate systemUsed figure is in getMemoryInfo()). [limited]
- returns
number: MB
system.getCpuUsage()
CPU usage of the ketec process (all threads).
- returns
number: Percent, 0.1 precision
system.startAgent()
Not implemented: ketec has no separate Agent service to start from scripts. [unsupported]
- returns
undefined: Always undefined
system.stopAgent()
Not implemented (see startAgent). [unsupported]
- returns
undefined: Always undefined
system.getAgentStatus()
Whether the Agent channel is connected.
- returns
boolean: true if the Agent channel is available
system.uptime()
System uptime.
- returns
number: Seconds since boot
device — Device info
Device identity, screen, battery, storage, volume, brightness, orientation, network address and vibration.
Modes: agent, hid
device.getBatteryInfo()
Battery level and charging state.
- returns
object: {level: 0–100, isCharging: boolean}
device.getStorageSpace()
Storage capacity.
- returns
object: {total, free, unit: "GB"} (decimal GB, 2 decimals)
device.getDeviceID()
ketec device identifier.
- returns
string: Device ID
device.getECID()
Device ECID.
- returns
string: ECID ("" if unavailable)
device.getUDID()
Device UDID.
- returns
string: UDID ("" if unavailable)
device.getDeviceName()
Device name.
- returns
string: Name
device.getDeviceModel()
Device model.
- returns
string: Model, e.g. "iPhone 12"
device.getScreenRealSize()
Screen size in pixels (the coordinate space for action/hid).
- returns
object: {width, height} in pixels
device.getScreenSize()
Screen size in points.
- returns
object: {width, height} in logical points
device.getScreenScale()
Pixels per point.
- returns
number: e.g. 3
device.getScreenBrightness()
Screen brightness.
- returns
number: 0–1
device.setScreenBrightness(brightness)
Sets screen brightness.
brightness(number): 0–1- returns
boolean: true on success
device.getVolume()
Media volume.
- returns
number: 0–1
device.setVolume(volume)
Sets media volume.
volume(number): 0–1- returns
boolean: true on success
device.getOrientation()
Screen orientation.
- returns
string: "PORTRAIT" or "LANDSCAPE"
device.getOSVersion()
iOS version.
- returns
string: e.g. "18.5"
device.getLanIp()
Local network address of the device.
- returns
string: LAN IPv4 address
device.vibrate(duration?, intensity?)
Vibrates with Core Haptics (falls back to the system vibration).
duration(number, optional, default 400): Milliseconds (1–10000)intensity(number, optional, default 0.5): 0–1- returns
boolean: true on success
device.getServerDeviceId()
Device id assigned by the ketec service.
- returns
string: Server-side device id
hid — HID device (ESP32)
Direct control through the external USB HID device (ESP32-S3 firmware): absolute pointer taps/swipes, keyboard keys, media buttons and system shortcuts. Works without the Agent. Coordinates are screen pixels. Key-code constants are available as hidKey (e.g. hidKey.COMMAND, hidKey.RETURN, hidKey.A).
Modes: hid
hid.openRecordScreen()
Shows the system screen-broadcast picker (needed for screenshots/OCR in HID mode).
- returns
undefined: —
hid.isRecording()
Whether screen capture is running.
- returns
boolean: true if the screen broadcast (or in-app recording) is active
hid.isBLEConnected()
Bluetooth HID is not supported (USB firmware only); always false. [unsupported]
- returns
boolean: Always false
hid.isUSBConnected()
Whether the USB HID device is connected.
- returns
boolean: Connection state
hid.getBLEHIDDeviceName()
Bluetooth HID not supported; returns "". [unsupported]
- returns
string: Always ""
hid.setBLEHIDDeviceName(name)
Bluetooth HID not supported; returns false. [unsupported]
name(string): Name- returns
boolean: Always false
hid.getDeviceMac()
HID device MAC address.
- returns
string: MAC, "" if not connected
hid.getDeviceModel()
HID device model.
- returns
string: e.g. "esp32s3", "" if not connected
hid.getDeviceVersion()
HID firmware version.
- returns
string: Firmware version
hid.resetPosition()
Re-sends screen size and coordinate mode to the firmware (re-calibrates the pointer).
- returns
boolean: true on success
hid.restartDevice()
Restarts the HID device; it reconnects in about a second.
- returns
boolean: true on success
hid.setCharging(on)
Not supported by the firmware; returns false. [unsupported]
on(boolean): On/off- returns
boolean: Always false
hid.setJitterValue(value)
Same as action.setJitterValue; affects Agent-synthesized gestures only (HID taps have no jitter). [limited]
value(number): Amplitude- returns
undefined: —
hid.setActionDelay(milliseconds)
Sets the firmware delay between actions.
milliseconds(number): 0 = off, >0 = set, <0 = firmware default- returns
boolean: true on success
hid.setMoveDelay(milliseconds)
Sets the firmware pointer-move delay.
milliseconds(number): 0 = off, >0 = set, <0 = default- returns
boolean: true on success
hid.move(x, y)
Moves the pointer without pressing.
x(number): X (screen pixels)y(number): Y (screen pixels)- returns
boolean: true on success
hid.click(x, y, duration?, jitter?)
Taps a point.
x(number): X (screen pixels)y(number): Y (screen pixels)duration(number, optional, default 60): Press time (ms); a long value = long pressjitter(boolean, optional, default false): Ignored on HID- returns
boolean: true on success
hid.click(540, 1200);
hid.mouseDown()
Presses and holds the pointer button at the current position.
- returns
boolean: true on success
hid.mouseUp()
Releases the pointer button.
- returns
boolean: true on success
hid.clickRandom(x1, y1, x2, y2, duration?)
Taps a random point inside the rectangle.
x1(number): Left of the area (pixels)y1(number): Top of the area (pixels)x2(number): Right of the area (pixels)y2(number): Bottom of the area (pixels)duration(number, optional, default 20): Press time (ms)- returns
boolean: false if the rectangle is invalid
hid.doubleClick(x, y, duration?, interval?, jitter?)
Double-taps a point.
x(number): X (screen pixels)y(number): Y (screen pixels)duration(number, optional, default 20): Press timeinterval(number, optional, default 20): Gap (ms)jitter(boolean, optional, default false): Ignored- returns
boolean: true on success
hid.doubleClickRandom(x1, y1, x2, y2, duration?, interval?)
Double-taps a random point inside the rectangle.
x1(number): Left of the area (pixels)y1(number): Top of the area (pixels)x2(number): Right of the area (pixels)y2(number): Bottom of the area (pixels)duration(number, optional, default 20): Press timeinterval(number, optional, default 20): Gap- returns
boolean: false if the rectangle is invalid
hid.swipe(x, y, ex, ey, jitter?, steps?)
Straight swipe (about 300 ms). A number as the 5th argument is taken as the duration in ms.
x(number): Start Xy(number): Start Yex(number): End Xey(number): End Yjitter(boolean, optional, default false): Ignored on HIDsteps(number, optional): Ignored on HID- returns
boolean: true on success
hid.swipeCurve(startX, startY, midX, midY, endX, endY)
Swipes along a quadratic curve through the control point.
startX(number): Start XstartY(number): Start YmidX(number): Control XmidY(number): Control YendX(number): End XendY(number): End Y- returns
boolean: true on success
hid.pressAndSwipe(startX, startY, endX, endY, duration?)
Press, hold, drag to the end point and release. iOS may only enter jiggle mode on the first try when dragging Home Screen icons. [limited]
startX(number): Start XstartY(number): Start YendX(number): End XendY(number): End Yduration(number, optional, default 500): Hold time before moving (ms)- returns
boolean: true on success
hid.homeScreen()
Goes to the Home Screen (requires HID run mode).
- returns
boolean: true on success
hid.input(text, frequency?)
Types text. Uses the ketec keyboard when it is on screen (recommended for Chinese/symbols), otherwise clipboard/HID fallbacks.
text(string): Text (Unicode supported)frequency(number, optional): Ignored- returns
boolean: true on success
hid.inputSimple(text)
Types text key by key (same as action.inputSimple).
text(string): Text- returns
boolean: true on success
hid.space()
Types a space.
- returns
boolean: true on success
hid.backspace(count?)
Presses Backspace.
count(number, optional, default 1): Times- returns
boolean: true on success
hid.enter()
Presses Return.
- returns
boolean: true on success
hid.sendKey(keys)
Sends a key combination. Modifier shortcuts inside text fields may not work without a software keyboard (iOS limitation); system shortcuts such as Cmd+H / Cmd+Space work.
keys(array): Key codes / names / single characters, e.g. [hidKey.COMMAND, "h"]- returns
boolean: true on success
hid.sendKey([hidKey.COMMAND, 'h']);
hid.pressButton(button)
Presses a media/system button.
button(string): home, volumeup, volumedown, mute, playpause, next, prev, brightnessup, brightnessdown, eject, globe, recent, search, power, snapshot (case-sensitive)- returns
boolean: true on success
hid.copyText()
Sends Cmd+C. May have no effect in text fields without a software keyboard. [limited]
- returns
boolean: true on success
hid.pasteText()
Sends Cmd+V. Same limitation as copyText. [limited]
- returns
boolean: true on success
hid.back()
Sends Tab+B ("back" in iOS Full Keyboard Access); only works when that accessibility feature is enabled. [limited]
- returns
boolean: true on success
hid.recent()
Opens the App Switcher (double Home).
- returns
boolean: true on success
hid.lock()
Locks the screen.
- returns
boolean: true on success
hid.unlock()
Wakes the screen (presses Home twice); does not enter a passcode.
- returns
boolean: true on success
hid.openURL(url)
Opens a URL through the ketec Shortcuts helper, falling back to opening locally; works while ketec is in background.
url(string): URL / scheme (scheme optional for web links)- returns
boolean: true on success
hid.openApp(name)
Launches an app by bundle id.
name(string): Bundle id- returns
boolean: true on success
hid.closeApp(name)
Closes an app; in HID mode this is done with an App Switcher gesture (takes a few seconds).
name(string): Bundle id (closeApp also accepts an app name)- returns
boolean: true on success
hid.takeMeToFront()
Brings ketec to the front.
- returns
boolean: true on success
hid.currentAppInfo()
Foreground app; usually undefined in HID mode because there is no foreground-app source without the Agent. [limited]
- returns
object|undefined: {name, bundleId} or undefined
hid.setClipboard(text)
Writes the clipboard.
text(string): Text- returns
boolean: true on success
hid.getClipboard()
Reads the clipboard.
- returns
string: Clipboard text
hid.isConnected()
Same as isUSBConnected.
- returns
boolean: Connection state
ime — ketec keyboard
Text operations through the ketec keyboard extension. Most functions require the ketec keyboard to be the active keyboard and visible; when it is not, some fall back to Agent/HID key events.
Modes: agent, hid
ime.isOk()
Checks that the keyboard is ready.
- returns
boolean: true if the ketec keyboard is installed and on screen
ime.getText()
Reads the text of the focused field.
- returns
string: Current field text, "" if unavailable
ime.clearText()
Clears the focused field.
- returns
boolean: true on success
ime.input(text, frequency?)
Inserts text through the keyboard (HID fallback when the keyboard is not visible).
text(string): Textfrequency(number, optional): Ignored- returns
boolean: true on success
if (ime.isOk()) ime.input('你好');ime.paste(text?)
Pastes text into the focused field.
text(string, optional): Text to paste; omitted = current clipboard- returns
string: Pasted text, "" on failure
ime.pressDel()
Deletes one character (Agent key event, or HID in HID mode).
- returns
boolean: true on success
ime.pressEnter()
Presses Return (Agent or HID).
- returns
boolean: true on success
ime.dismiss()
Hides the keyboard.
- returns
boolean: true on success
ime.getClipboard()
Reads the clipboard.
- returns
string: Clipboard text
ime.setClipboard(text)
Writes the clipboard.
text(string): Text- returns
boolean: true on success
ime.switchKeyboard()
Switches to the next input method (keyboard globe action, or Ctrl+Space via HID).
- returns
boolean: true on success
http — HTTP client
Synchronous HTTP requests and file download. Available in JavaScript and Lua; in Python use the bundled requests / urllib instead.
Modes: agent, hid
http.httpGet(url, timeout?)
GET request.
url(string): URLtimeout(number, optional, default 10): Timeout in seconds- returns
object: {status, body} or {error}
var r = http.httpGet('https://example.com'); logi(r.status);http.httpPost(url, body, timeout?)
POST request with a string body.
url(string): URLbody(string): Request body (sent as application/json when non-empty)timeout(number, optional, default 10): Seconds- returns
object: {status, body} or {error}
http.postJSON(url, data, timeout?)
POST a JSON body.
url(string): URLdata(object|string): Object (JSON-encoded) or JSON stringtimeout(number, optional, default 10): Seconds- returns
object: {status, body} or {error}
http.request(options)
Full-featured request. Redirects are always followed. A legacy form request(method, url, body, timeout) is also accepted.
options(object): {url, method="GET", header:{}, cookie:{}, data:{} (query for GET, form for others), requestBody:string, file:{field: path} (multipart), timeout (ms, default 30000), userAgent, referrer, responseCharset}- returns
object: {statusCode, statusMessage, contentType, charset, body, header, cookie, error?}
http.downloadFile(url, path, timeout?, headers?)
Downloads to a file (2xx only).
url(string): URLpath(string): Destination inside the app sandbox (relative = Documents)timeout(number, optional, default 10000): Timeout in millisecondsheaders(object, optional): Request headers- returns
boolean: true on success
http.newWebsocket(url)
Opens a WebSocket client. Sending works, but the on* callbacks are never invoked and heartbeat/timeout/auto-reconnect setters are no-ops, so incoming messages cannot be read. [limited]
url(string): ws:// or wss:// URL- returns
object|null: {connect, close, reset, sendText, sendBinary(base64), isConnected, isClosed, onOpen, onText, onBinary, onClose, onError, ...}
file — Files
File and folder operations. Relative paths (and paths starting with "Documents/") resolve under the app Documents folder; absolute paths must be inside the app sandbox; ".." is rejected.
Modes: agent, hid
file.getInternalDir(type?)
Returns an app directory path.
type(string, optional, default "documents"): "documents", "library", "caches" or "temp"- returns
string: Absolute directory path
file.create(path)
Creates an empty file (true if it already exists).
path(string): File path (relative = app Documents)- returns
boolean: true on success
file.mkdirs(path)
Creates a directory with parents.
path(string): Directory path- returns
boolean: true on success
file.deleteAllFile(path)
Deletes a file or a whole directory.
path(string): File or directory- returns
boolean: true on success
file.readFile(path)
Reads a text file.
path(string): File path (relative = app Documents)- returns
string|undefined: UTF-8 text
file.readResFile(fileName)
Not supported: there is no project resource directory; place files under Documents and use readFile. [unsupported]
fileName(string): Resource name- returns
undefined: Always undefined
file.getResFile(fileName)
Not supported (see readResFile). [unsupported]
fileName(string): Resource name- returns
undefined: Always undefined
file.cleanupResFile(path)
Not supported (see readResFile). [unsupported]
path(string): File path (relative = app Documents)- returns
undefined: Always undefined
file.deleteLine(path, line, contains?)
Deletes lines from a text file.
path(string): File path (relative = app Documents)line(number): 1-based line number; ≤0 to match by text onlycontains(string, optional): Delete lines containing this text (with line>0, both must match)- returns
boolean: true if a line was removed
file.listDir(path, recursion?)
Lists a directory.
path(string): Directoryrecursion(boolean, optional, default false): Recurse into subfolders- returns
string[]: Absolute paths
file.writeFile(path, data)
Writes a text file (creates parent folders).
path(string): File path (relative = app Documents)data(string): Content (overwrites)- returns
boolean: true on success
file.appendLine(path, data)
Appends data plus a newline (no newline is inserted before it if the file does not end with one).
path(string): File path (relative = app Documents)data(string): Line to append- returns
boolean: true on success
file.readLine(path, lineNo)
Reads one line.
path(string): File path (relative = app Documents)lineNo(number): 1-based line number- returns
string|undefined: Line text
file.readAllLines(path)
Reads all lines.
path(string): File path (relative = app Documents)- returns
string[]|undefined: Lines
file.exists(path)
Checks whether a path exists.
path(string): File path (relative = app Documents)- returns
boolean: Exists
file.copy(src, dest)
Copies a file or folder.
src(string): Sourcedest(string): Destination (must not exist)- returns
boolean: true on success
file.fileMD5(path)
MD5 of a file.
path(string): File path (relative = app Documents)- returns
string|undefined: Lowercase hex MD5
config — Script config
Persistent key/value configuration for the current script package (the same store the package UI page reads and writes). Values keep their JSON type.
Modes: agent, hid
config.all()
Returns all config values.
- returns
object: All key/values
config.setAll(config)
Writes several values.
config(object): Key/value object- returns
boolean: true on success
config.set(key, value)
Sets one value.
key(string): Keyvalue(any): Value- returns
boolean: true on success
config.get(key)
Reads one value.
key(string): Key- returns
any: Value or undefined
var n = config.get('loops') || 10;config.remove(key)
Removes a key.
key(string): Key- returns
boolean: true on success
sharedState — Shared state
In-memory key/value store shared by all scripts and threads in the ketec process (useful for communication with thread.run workers). Not persisted across app restarts.
Modes: agent, hid
sharedState.set(key, value)
Sets a value.
key(string): Keyvalue(any): Value- returns
boolean: true on success
sharedState.get(key)
Reads a value.
key(string): Key- returns
any: Value or undefined
sharedState.withBatch(block)
Runs a function, or sets every key of an object.
block(function|object): A function to run, or an object whose keys are all set- returns
boolean: true on success
sharedState.clear()
Removes all keys.
- returns
boolean: true on success
plist — Property lists
Read and modify .plist files. Paths follow the file-module rules.
Modes: agent, hid
plist.read(path)
Reads a plist file.
path(string): File path (relative = app Documents)- returns
any: Parsed root object, undefined on failure
plist.write(path, value, format?)
Writes a plist file.
path(string): File path (relative = app Documents)value(object|array): Root valueformat(string, optional, default "xml"): "xml" or "binary"- returns
boolean: true on success
plist.get(path, key)
Reads a (nested) key.
path(string): File path (relative = app Documents)key(string|array): Key, or an array path such as ["a", 0, "b"]- returns
any: Value or undefined
plist.set(path, key, value)
Sets a (nested) key, creating the file/dictionaries if needed.
path(string): File path (relative = app Documents)key(string|array): Key, or an array path such as ["a", 0, "b"]value(any): Value- returns
boolean: true on success
plist.remove(path, key)
Removes one key (never deletes the file).
path(string): File path (relative = app Documents)key(string|array): Key, or an array path such as ["a", 0, "b"]- returns
boolean: true on success
sqlite — SQLite
Local SQLite databases. open() returns a string handle used by the other functions.
Modes: agent, hid
sqlite.open(path)
Opens (or creates) a database.
path(string): DB file (relative = Documents), ":memory:" or a file: URI- returns
string|null: Handle
var db = sqlite.open('data.db'); sqlite.execute(db, 'CREATE TABLE IF NOT EXISTS t(a TEXT)');sqlite.close(handle)
Closes the database.
handle(string): Handle returned by open()- returns
boolean: true on success
sqlite.isOpen(handle)
Whether the handle is open.
handle(string): Handle returned by open()- returns
boolean: Open state
sqlite.query(handle, sql, params?)
Runs a query and returns rows.
handle(string): Handle returned by open()sql(string): SQL with ? placeholdersparams(array, optional, default []): Bound values- returns
object: {success, rows: [{col: value}], affectedRows, insertId, error}
sqlite.execute(handle, sql, params?)
Executes a statement.
handle(string): Handle returned by open()sql(string): SQLparams(array, optional, default []): Bound values- returns
object: {success, rows: [{col: value}], affectedRows, insertId, error}
sqlite.beginTransaction(handle)
BEGIN.
handle(string): Handle returned by open()- returns
boolean: true on success
sqlite.commit(handle)
COMMIT.
handle(string): Handle returned by open()- returns
boolean: true on success
sqlite.rollback(handle)
ROLLBACK.
handle(string): Handle returned by open()- returns
boolean: true on success
mysql — MySQL client
Built-in MySQL client with one global connection shared by all scripts. Value mapping: integers come back as strings, DATE/DATETIME as ISO-8601 strings, DECIMAL/DOUBLE as numbers, TIME/JSON as null.
Modes: agent, hid
mysql.connect(config)
Connects (replacing any previous connection).
config(object): {host, port=3306, username, password, database, charset="utf8mb4", connectTimeout=5000, queryTimeout=30000}- returns
boolean: true on success
mysql.disconnect()
Closes the connection.
- returns
undefined: —
mysql.isConnected()
Connection state.
- returns
boolean: Alive
mysql.query(sql, params?)
Runs a query.
sql(string): SQL with ? placeholdersparams(array, optional, default []): Bound values- returns
object: {rows, affectedRows, insertId, success, error}
mysql.execute(sql, params?)
Executes a statement.
sql(string): SQLparams(array, optional, default []): Bound values- returns
object: {rows, affectedRows, insertId, success, error}
mysql.beginTransaction()
START TRANSACTION.
- returns
boolean: true on success
mysql.commit()
COMMIT.
- returns
boolean: true on success
mysql.rollback()
ROLLBACK.
- returns
boolean: true on success
zipFile — ZIP archives
Create and extract ZIP files. Paths follow the file-module rules.
Modes: agent, hid
zipFile.getFileList(path)
Lists entries of a ZIP.
path(string): ZIP file- returns
string[]: Entry names (directories excluded)
zipFile.isZip(path)
Checks whether a file is a ZIP.
path(string): File path (relative = app Documents)- returns
boolean: true if the file starts with the ZIP signature
zipFile.unzip(zipPath, destDir)
Extracts a ZIP (entries containing ".." are skipped).
zipPath(string): ZIP filedestDir(string): Destination folder (created)- returns
number|boolean: Number of extracted files; false on error
zipFile.zip(dirPath, zipPath)
Compresses a folder or file.
dirPath(string): Source folder or file (kept as top-level folder)zipPath(string): Output ZIP path (must not be inside the source)- returns
boolean: true on success
zipFile.zip('logs', 'out/logs.zip');media — Photos & audio
Save to / clean the photo library and play MP3 files. Photo-library access permission is requested when needed.
Modes: agent, hid
media.saveImageToAlbum(imageId)
Saves an image to Photos.
imageId(string): imageId from the image module- returns
boolean: true on success
media.saveVideoToAlbumPath(path)
Saves a video file to Photos.
path(string): Video file- returns
boolean: true on success
media.deleteAllPhotos()
Deletes all photos. Returns immediately; iOS then asks the user to confirm.
- returns
boolean: true once the deletion request is submitted
media.deleteAllVideos()
Deletes all videos (iOS asks for confirmation).
- returns
boolean: true once submitted
media.deleteAllScreenshotAssets()
Deletes all screenshots (iOS asks for confirmation).
- returns
boolean: true once submitted
media.playMp3(path, loop?)
Starts playing an audio file (non-blocking).
path(string): Audio fileloop(boolean, optional, default false): Loop forever- returns
boolean: true on success
media.stopMp3()
Stops playback.
- returns
boolean: true on success
media.playMp3WaitEnd(path)
Plays and blocks until finished.
path(string): Audio file- returns
boolean: true on success
media.isMp3Playing()
Whether audio is playing.
- returns
boolean: Playing
media.deleteAllScreenshots()
Same as deleteAllScreenshotAssets.
- returns
boolean: true once submitted
utils — Utilities
Time formatting, random numbers, UUID, Base64/hex conversion, bring ketec to front.
Modes: agent, hid
utils.timeFormat(format?)
Formats the current time.
format(string, optional, default "yyyy-MM-dd HH:mm:ss"): Unicode date pattern- returns
string: Formatted current time
utils.timeFormat('yyyyMMdd-HHmmss');utils.random(min, max)
Random integer in [min, max].
min(number, default 0): Minimum (inclusive)max(number, default 100): Maximum (inclusive)- returns
number: Integer
utils.takeMeToFront()
Brings ketec to the foreground (asynchronous).
- returns
boolean: true on success
utils.randomUUID()
Random UUID string.
- returns
string: UUID
utils.hexString(source)
Text to hex.
source(string): Text- returns
string: Lowercase hex of the UTF-8 bytes
utils.base64Encoded(source)
Base64-encodes UTF-8 text.
source(string): Text- returns
string: Base64
utils.base64Decoded(source)
Base64 to text.
source(string): Base64- returns
string: Decoded text ("" if invalid)
utils.hexStringBase64Encoded(hexString)
Hex bytes to Base64.
hexString(string): Hex bytes- returns
string|undefined: Base64
utils.hexStringBase64Decoded(base64HexString)
Base64 to hex bytes.
base64HexString(string): Base64- returns
string|undefined: Hex
utils.formatDate(timestamp?, format?)
Formats a timestamp.
timestamp(number, optional): Seconds or milliseconds; default nowformat(string, optional, default "yyyy-MM-dd HH:mm:ss"): Pattern- returns
string: Formatted time
cryptoUtils — Crypto
Hashes/HMAC, AES-ECB and RSA (PKCS#1 v1.5).
Modes: agent, hid
cryptoUtils.encryptWithAES_ECB(data, aesKey, noPadding?)
AES-ECB encryption.
data(string): PlaintextaesKey(string): 16/24/32-char key, or 32/48/64 hex charsnoPadding(boolean, optional, default false): Disable PKCS7 padding- returns
string|undefined: Base64 ciphertext
cryptoUtils.decryptWithAES_ECB(data, aesKey, noPadding?)
AES-ECB decryption.
data(string): Base64 ciphertextaesKey(string): Key (same rules)noPadding(boolean, optional, default false): No padding- returns
string|undefined: UTF-8 plaintext
cryptoUtils.encryptWithRSA(data, publicKeyBase64)
RSA encryption (PKCS#1 v1.5).
data(string): PlaintextpublicKeyBase64(string): Public key, PEM or Base64 DER- returns
string: Base64 ciphertext, "" on failure
cryptoUtils.decryptWithRSA(encryptedData, privateKeyBase64)
RSA decryption.
encryptedData(string): Base64 ciphertextprivateKeyBase64(string): Private key, PEM or Base64- returns
string: Plaintext, "" on failure
cryptoUtils.md5(source)
MD5 digest.
source(string): Text- returns
string: Lowercase hex
cryptoUtils.sha1(source, key?)
SHA-1 or HMAC-SHA1.
source(string): Textkey(string, optional): If given, HMAC-SHA1 with this key- returns
string: Lowercase hex
cryptoUtils.sha256(source, key?)
SHA-256 or HMAC-SHA256.
source(string): Textkey(string, optional): If given, HMAC-SHA256- returns
string: Lowercase hex
logger — Logging
Write log lines. In a running script package lines go to the ketec run log (visible in the app and via the log endpoints).
Modes: agent, hid
logger.debug(args)
Debug-level log.
args(any): Message (Python joins several arguments)- returns
boolean: true on success
logger.info(args)
Info-level log.
args(any): Message- returns
boolean: true on success
logger.info('step 1 done');logger.warn(args)
Warning-level log.
args(any): Message- returns
boolean: true on success
logger.error(args)
Error-level log.
args(any): Message- returns
boolean: true on success
logger.setLoggerLevel(level)
Stores the minimum log level [effect on output unverified]. [limited]
level(string, optional, default "info"): debug / info / warn / error- returns
boolean: true on success
logger.setLogToFile(enabled)
Stores the log-to-file preference [effect unverified]. [limited]
enabled(boolean): On/off- returns
boolean: true on success
logger.setMaxLogFileCount(count)
Stores the max log file count [effect unverified]. [limited]
count(number, optional, default 5): Max files- returns
boolean: true on success
logger.setMaxLogFileSize(size)
Stores the max log file size [effect unverified]. [limited]
size(number, optional, default 1048576): Bytes- returns
boolean: true on success
logger.resetLogFile()
Deletes the script log file.
- returns
boolean: true on success
g — Globals & run control
Script-wide functions. JavaScript: global functions (sleep, time, exit, logi/logw/loge/logd, createNodeSelector, setStopCallback ...). Python: from ketec import g (g.setStopCallback(...), constants g.runMode, g.appVersion, g.appName, g.appBundleId, g.appBuildNumber, g.isDebug, g.platform, g.packageJson, g.startParams; use time.sleep). Lua: capitalized globals Sleep, Exit, Time, TakeMeToFront, SetStopCallback, RestartScript, StartThread/StopThread, ToJsonString, constants RunMode, AppVersion, PackageJson, StartParams ...
Modes: agent, hid
takeMeToFront()
Brings ketec to the foreground.
- returns
boolean: true on success
setAgentTouchMode(mode)
Stores the Agent touch mode. In the current build the value is saved and returned but does not change how taps are synthesized. [limited]
mode(number): 0 standard, 1 fast, 2 real tap (invalid → 1)- returns
number: The stored mode
getAgentTouchMode()
Reads the stored Agent touch mode.
- returns
number: 0/1/2, default 1
setCpuAutoThrottle(enabled)
Stores the CPU auto-throttle switch. Saved only; no throttling is applied in the current build. [limited]
enabled(boolean): On/off- returns
boolean: The stored value
getCpuAutoThrottle()
Reads the stored switch.
- returns
boolean: Default true
setCpuThrottleDelay(min_ms, max_ms)
Stores the throttle delay range (saved only). [limited]
min_ms(number): Minimum delay (ms); an object {minMs, maxMs} is also acceptedmax_ms(number): Maximum delay (ms)- returns
object: {minMs, maxMs} as stored
getCpuThrottleDelay()
Reads the stored delay range.
- returns
object: {minMs, maxMs}, default {3, 30}
restartScript(delay_ms?)
Ends the current run and restarts the package script.
delay_ms(number, optional, default 2000): Python: wait before restart (at least 2000 ms); ignored in JavaScript- returns
undefined: —
setStopCallback(callback)
Registers a stop callback (package runs).
callback(function): Called with "stopped" when the script is stopped, or "error" after an uncaught exception (about 3 s allowed)- returns
boolean: true on success
setStopCallback(function(status){ logi('stopped: ' + status); });setExceptionCallback(callback)
Registers an uncaught-exception callback (package runs).
callback(function): Called with the error object- returns
boolean: true on success
sleep(ms)
Pauses the script (JavaScript; Lua: Sleep; Python: time.sleep).
ms(number): Milliseconds- returns
undefined: —
sleep(500);
time()
Current timestamp in ms (Lua: Time).
- returns
number: Milliseconds since epoch
exit()
Ends the script normally (Lua: Exit; Python: sys.exit).
- returns
undefined: —
logi(msg) / logw(msg) / loge(msg) / logd(msg)
Writes an info/warn/error/debug line to the run log (console.log maps to info).
msg(any): Message- returns
undefined: —
println(value)
No-op kept for compatibility; returns null and writes nothing (use logi). [limited]
value(any): Ignored- returns
null: null
setTimeout(fn, ms) / setInterval(fn, ms) / clearTimeout(id) / clearInterval(id)
Timers return a handle but the callback is never executed (no event loop); use sleep() in a loop instead. [limited]
fn(function): Callbackms(number): Delay- returns
number: A handle
ui — Dialogs & package UI
Toasts and dialogs shown inside the ketec app, plus messaging with the package UI page. Dialogs need ketec in the foreground.
Modes: agent, hid
ui.show(text?)
Shows a simple translucent text panel over the ketec window. It does not open the package UI page. [limited]
text(string, optional): Text shown on the panel- returns
boolean: true on success
ui.hide()
Removes the panel shown by ui.show.
- returns
boolean: true on success
ui.showToast(message)
Shows a short toast in the ketec window (visible only when ketec is in front).
message(string): Text- returns
boolean: true on success
ui.confirm(title, message)
Shows an OK/Cancel dialog and waits for the user.
title(string): Titlemessage(string): Message- returns
boolean: true = OK, false = Cancel / no window / timeout (10 min)
ui.confirmInput(title, message, defaultInput?)
Shows a text-input dialog and waits.
title(string): Titlemessage(string): MessagedefaultInput(string, optional): Ignored by the current binding- returns
string: Entered text, "" on cancel
ui.alert(title, message)
Shows an alert; returns immediately without waiting.
title(string): Title (a single argument is treated as the message)message(string): Message- returns
boolean: true on success
ui.onEvent(eventName, callback)
Listens for events emitted by the package UI page while the script runs (delivered during sleep()). Note: the current binding takes (eventName, callback), not a single callback.
eventName(string): Event name sent by the package UI pagecallback(function): Receives the event data- returns
boolean: true on success
ui.call(key, data?)
Calls a function registered by the package UI page (package runs; fire-and-forget).
key(string): Function name registered by the UI pagedata(any, optional): Payload- returns
undefined: —
ui.callFloatingWindow(key, data?)
There is no separate floating web window; forwards to ui.call. [limited]
key(string): Namedata(any, optional): Payload- returns
any: Same as ui.call
ui.eval(code)
Runs JavaScript in a separate script context (not inside the UI page) with a 10 s limit. [limited]
code(string): JavaScript source- returns
any: Result value
ui.evalFloatingWindow(code)
Same as ui.eval. [limited]
code(string): JavaScript source- returns
any: Result value
pip — Floating window (PiP)
Uses system Picture-in-Picture as a floating window: log mode, keep-alive mode or custom text. Its position is controlled by iOS.
Modes: agent, hid
pip.isPipActive()
Whether the floating window is showing.
- returns
boolean: Visible
pip.switchToLogMode()
Shows script logs in the window.
- returns
boolean: true on success
pip.switchToKeepAliveMode()
Keep-alive mode.
- returns
boolean: true on success
pip.switchToCustomMode()
Custom text mode.
- returns
boolean: true on success
pip.closeWindow()
Closes the window.
- returns
boolean: true on success
pip.setContentSize(width, height)
Sets the content size (log/custom mode only).
width(number): Widthheight(number): Height- returns
boolean: true on success
pip.setPosition(x, y)
Not supported: iOS decides the PiP position. [unsupported]
x(number): Xy(number): Y- returns
boolean: Always false
pip.setLogFontSize(fontSize)
Log text size.
fontSize(number): Points- returns
boolean: true on success
pip.setCustomText(text)
Custom-mode text.
text(string): Text- returns
boolean: true on success
pip.setCustomTextColor(color)
Custom text color.
color(string): e.g. "#FFFFFF"- returns
boolean: true on success
pip.setCustomTextSize(fontSize)
Custom text size.
fontSize(number): Points- returns
boolean: true on success
pip.setCustomBackgroundColor(color)
Custom background color.
color(string): e.g. "#000000"- returns
boolean: true on success
thread — Script threads
Runs another script file in parallel in its own context. Exchange data through sharedState. JavaScript only (Python: threading; Lua: StartThread / StopThread).
Modes: agent, hid
thread.run(fileName, params?)
Starts a script thread.
fileName(string): Script file whose name ends with _thread.jsparams(object, optional): Start parameters, readable as __threadParams__ in the thread (__threadName__ holds its name)- returns
Thread|undefined: {name, cancel(), isCancelled(), isExecuting()}
var t = thread.run('worker_thread.js', {n: 3});thread.stopAll()
Requests all running threads to stop.
- returns
boolean: true on success
tts — Text to speech
Speech synthesis with the system voices.
Modes: agent, hid
tts.speak(text, rate?, pitch?, volume?, language?)
Queues speech (non-blocking).
text(string): Textrate(number, optional, default 0.5): 0–1pitch(number, optional, default 1): 0.5–2volume(number, optional, default 1): 0–1language(string, optional, default "zh-CN"): Language code- returns
boolean: true on success
tts.speak('任务完成'); tts.waitEnd();tts.waitEnd()
Blocks until queued speech finishes.
- returns
undefined: —
tts.stop()
Stops speaking.
- returns
undefined: —
tts.isSpeaking()
Whether speech is in progress.
- returns
boolean: Speaking
tts.getAvailableVoices()
Lists system voices.
- returns
array: [{identifier, name, language, quality}]
tts.setVoice(voiceIdentifier)
Selects a voice.
voiceIdentifier(string): identifier from getAvailableVoices- returns
boolean: true on success
tts.free()
Stops and releases the synthesizer.
- returns
undefined: —
cloud — Cloud control link
Connect ketec to your own WebSocket control server, report custom data and receive custom events.
Modes: agent, hid
cloud.connect(url, deviceNo?)
Connects for this run (does not change saved settings).
url(string): ws:// or wss:// server URLdeviceNo(string, optional): Device number; default = the one set in the app- returns
boolean: true on success
cloud.isConnected()
Connection state.
- returns
boolean: Connected
cloud.disconnect()
Disconnects.
- returns
undefined: —
cloud.report(event, data)
Sends {type:"scriptReport", event, data} to the server.
event(string): Non-empty event name ("cloud:status" for the overview status)data(object): JSON object- returns
boolean: true on success
cloud.report('task.finished', {ok: true});cloud.onEvent(callback)
Registers the single custom-event listener (delivered while the package script runs).
callback(function|null): callback(event, data) for server "scriptEvent" messages; null removes it- returns
undefined: —
netCard — License cards
Online card-key verification for the currently loaded script package.
Modes: agent, hid
netCard.isAuthCardMode()
Whether card-key mode is on.
- returns
boolean: true if card mode is enabled in settings
netCard.verify(cardNo)
Verifies online and stores the card for this package.
cardNo(string): Card key; empty = re-verify the stored card- returns
boolean: true on success
netCard.getCardInfo()
Returns verified card info.
- returns
object|undefined: Card info of this package, undefined if none
netCard.setCardRemark(remark)
Sets the server-side remark of the card.
remark(string): Remark- returns
boolean: true on success
hotUpdate — Package hot update
Checks for and installs a newer version of the current script package from the configured distribution server. [unverified on device]
Modes: agent, hid
hotUpdate.checkUpdate()
Checks whether an update exists. [unverified] [limited]
- returns
object: Update info [fields unverified]
hotUpdate.downloadAndInstall()
Downloads and installs; in a package run the script restarts at the next sleep() or when it ends. [unverified] [limited]
- returns
object: Result including updated: boolean [other fields unverified]
hotUpdate.getCurrentVersion()
Current package version.
- returns
number: Current package appVersion
ai — LLM helper
Stores LLM provider settings and sends prompts. [unverified] Not tested on device in this release; see each function for known limitations found in the source.
Modes: agent, hid
ai.setProvider(config)
Adds or updates a provider. [unverified]
config(object): {id?, name?, baseUrl, model, apiKey?, protocol: "openai"|"anthropic"|"gemini" (default openai), headers?, supportsVision?, isDefault?}; same id updates- returns
object|undefined: Saved provider, undefined if baseUrl/model missing or protocol invalid
ai.getProviders()
Lists providers.
- returns
array: Saved providers
ai.getDefaultProvider()
Returns the default provider id (a string, not an object). [limited]
- returns
string: Provider id set by setDefaultProvider, "" if none
ai.setDefaultProvider(id)
Stores the default provider id.
id(string): Provider id- returns
boolean: true on success
ai.removeProvider(id)
Returns true, but source review shows the provider is not actually removed in this build. [unverified] [limited]
id(string): Provider id- returns
boolean: Always true
ai.ask(prompt, options?)
Sends one prompt to an OpenAI-compatible chat endpoint. Source review: it reads an older endpoint setting that setProvider(config) does not write, so it may return {error} even after setProvider. [unverified] [limited]
prompt(string): Promptoptions(object, optional): Currently ignored- returns
object: {text} or {error}
ai.judge(question, options?)
Asks the model for true/false. Returns false without a default provider; since ask() returns an object, the result is false in practice. [unverified] [limited]
question(string): Statement to judgeoptions(object, optional): Ignored- returns
boolean: true/false
ai.extract(prompt, options?)
Asks the model to output JSON fields and parses it. Same limitation as judge. [unverified] [limited]
prompt(string): Source textoptions(any, optional): Field description- returns
object|null|undefined: Parsed JSON
ai.chat(messages, options?)
Same as ask with a single prompt. [unverified] [limited]
messages(string): In this build only a single prompt string is accepted (message arrays are not)- returns
object: {text} or {error}
ai.parseJson(text)
Parses JSON, also extracting the first {...} or [...] block from surrounding text.
text(string): Text that contains JSON- returns
any|null: Parsed value, null on failure
ai.lastError()
Returns the stored last error (not updated by ask in this build). [unverified] [limited]
- returns
string: Last error, usually ""
yolo — YOLO object detection
On-device YOLO detection with ncnn models (.param + .bin; v5/v8/v11/v26). You supply the model files.
Modes: agent, hid
yolo.load(paramPath, binPath, nc?, version?, useGpu?)
Loads a model.
paramPath(string): .param filebinPath(string): .bin filenc(number, optional, default 0): Number of classes (0 = auto)version(number, optional, default 11): YOLO version (5/8/11/26)useGpu(boolean, optional, default false): Use GPU- returns
string|undefined: modelId
yolo.detectAbs(modelId, img, x?, y?, ex?, ey?, targetSize?, threshold?, nmsThreshold?)
Runs detection.
modelId(string): Model id from load()img(string): imageId, "screen" or file pathx(number, optional, default 0): Region lefty(number, optional, default 0): Region topex(number, optional, default 0): Region right (0 = whole)ey(number, optional, default 0): Region bottomtargetSize(number, optional, default 640): Input sizethreshold(number, optional, default 0.4): Confidence thresholdnmsThreshold(number, optional, default 0.5): NMS IoU threshold- returns
array: [{x, y, ex, ey, centerX, centerY, width, height, confidence, classId}] absolute coordinates
var m = yolo.load('m.param','m.bin'); var r = yolo.detectAbs(m, 'screen');yolo.free(modelId)
Releases a model.
modelId(string): Model id from load()- returns
undefined: —
yolo.freeAll()
Releases all models.
- returns
undefined: —
yolo.detect(modelId, img, targetSize?, threshold?, nmsThreshold?)
Whole-image detection.
modelId(string): Model id from load()img(string): imageId, "screen" or file pathtargetSize(number, optional, default 640): Input sizethreshold(number, optional, default 0.4): ThresholdnmsThreshold(number, optional, default 0.5): NMS- returns
array: Same as detectAbs
yoloCls — YOLO classification
On-device YOLO classification with ncnn models.
Modes: agent, hid
yoloCls.load(paramPath, binPath, nc?, useGpu?)
Loads a classifier.
paramPath(string): .param filebinPath(string): .bin filenc(number, optional, default 0): Classes (0 = auto)useGpu(boolean, optional, default false): GPU- returns
string|undefined: modelId
yoloCls.classify(modelId, img, targetSize?)
Classifies the whole image.
modelId(string): Model id from load()img(string): imageId, "screen" or file pathtargetSize(number, optional, default 224): Input size- returns
object: {data, top1, top5, top1conf, top5conf}
yoloCls.classifyRegion(modelId, img, x?, y?, ex?, ey?, targetSize?)
Classifies a region.
modelId(string): Model id from load()img(string): imageId, "screen" or file pathx(number, optional, default 0): Lefty(number, optional, default 0): Topex(number, optional, default 0): Rightey(number, optional, default 0): BottomtargetSize(number, optional, default 224): Input size- returns
object: Same as classify
yoloCls.free(modelId)
Releases a model.
modelId(string): Model id from load()- returns
undefined: —
yoloCls.freeAll()
Releases all models.
- returns
undefined: —
cv — OpenCV
OpenCV 4.14 bindings for JavaScript and Lua. Images are Mat handles (strings like "$CV_MAT$_…"); functions take Mat handle(s) plus an options object using OpenCV parameter names and return new Mat handles or plain values; failures return undefined (reason in the log). Convert with cv.fromImageId / cv.toImageId and release Mats with cv.release. Python scripts use the bundled cv2 + numpy instead (image.captureMat()).
Modes: agent, hid
cv.BFMatcher(...)
Brute-force descriptor matching.
- returns
any: Mat handle, value or undefined
cv.CLAHE(...)
Contrast-limited adaptive histogram equalization.
- returns
any: Mat handle, value or undefined
cv.Canny(...)
Canny edge detection.
- returns
any: Mat handle, value or undefined
cv.FAST(...)
FAST corner detection.
- returns
any: Mat handle, value or undefined
cv.FlannBasedMatcher(...)
FLANN descriptor matching.
- returns
any: Mat handle, value or undefined
cv.GaussianBlur(...)
Gaussian blur.
- returns
any: Mat handle, value or undefined
cv.HoughCircles(...)
Detect circles (Hough transform).
- returns
any: Mat handle, value or undefined
cv.HoughLinesP(...)
Detect line segments (probabilistic Hough).
- returns
any: Mat handle, value or undefined
cv.HuMoments(...)
Hu invariant moments from moments.
- returns
any: Mat handle, value or undefined
cv.LUT(...)
Look-up table transform.
- returns
any: Mat handle, value or undefined
cv.Laplacian(...)
Laplacian filter.
- returns
any: Mat handle, value or undefined
cv.Mat(...)
Create a Mat filled with a scalar ({rows, cols, type, scalar}).
- returns
any: Mat handle, value or undefined
cv.ORB(...)
ORB keypoints and descriptors.
- returns
any: Mat handle, value or undefined
cv.SIFT(...)
SIFT keypoints and descriptors.
- returns
any: Mat handle, value or undefined
cv.Scharr(...)
Scharr derivative.
- returns
any: Mat handle, value or undefined
cv.Sobel(...)
Sobel derivative.
- returns
any: Mat handle, value or undefined
cv.absdiff(...)
Per-element absolute difference.
- returns
any: Mat handle, value or undefined
cv.adaptiveThreshold(...)
Adaptive threshold.
- returns
any: Mat handle, value or undefined
cv.add(...)
Per-element addition.
- returns
any: Mat handle, value or undefined
cv.addWeighted(...)
Weighted sum of two images.
- returns
any: Mat handle, value or undefined
cv.approxPolyDP(...)
Polygon approximation of a contour.
- returns
any: Mat handle, value or undefined
cv.arcLength(...)
Contour perimeter.
- returns
any: Mat handle, value or undefined
cv.arrowedLine(...)
Draw an arrowed line.
- returns
any: Mat handle, value or undefined
cv.at(...)
Read one pixel (row, col) as a channel array.
- returns
any: Mat handle, value or undefined
cv.bilateralFilter(...)
Bilateral filter.
- returns
any: Mat handle, value or undefined
cv.bitwise_and(...)
Bitwise AND.
- returns
any: Mat handle, value or undefined
cv.bitwise_not(...)
Bitwise NOT.
- returns
any: Mat handle, value or undefined
cv.bitwise_or(...)
Bitwise OR.
- returns
any: Mat handle, value or undefined
cv.bitwise_xor(...)
Bitwise XOR.
- returns
any: Mat handle, value or undefined
cv.blur(...)
Box blur.
- returns
any: Mat handle, value or undefined
cv.boundingRect(...)
Upright bounding rectangle.
- returns
any: Mat handle, value or undefined
cv.boxFilter(...)
Box filter.
- returns
any: Mat handle, value or undefined
cv.boxPoints(...)
Corner points of a rotated rectangle.
- returns
any: Mat handle, value or undefined
cv.calcBackProject(...)
Histogram back projection.
- returns
any: Mat handle, value or undefined
cv.calcHist(...)
Compute a histogram.
- returns
any: Mat handle, value or undefined
cv.capture(...)
Screenshot as a BGR Mat (optional x, y, ex, ey crop).
- returns
any: Mat handle, value or undefined
cv.circle(...)
Draw a circle.
- returns
any: Mat handle, value or undefined
cv.clone(...)
Copy a Mat.
- returns
any: Mat handle, value or undefined
cv.compare(...)
Per-element comparison.
- returns
any: Mat handle, value or undefined
cv.compareHist(...)
Compare two histograms.
- returns
any: Mat handle, value or undefined
cv.connectedComponents(...)
Label connected components.
- returns
any: Mat handle, value or undefined
cv.connectedComponentsWithStats(...)
Connected components with statistics.
- returns
any: Mat handle, value or undefined
cv.contourArea(...)
Contour area.
- returns
any: Mat handle, value or undefined
cv.convertScaleAbs(...)
Scale, take absolute value, convert to 8-bit.
- returns
any: Mat handle, value or undefined
cv.convexHull(...)
Convex hull of points.
- returns
any: Mat handle, value or undefined
cv.convexityDefects(...)
Convexity defects of a contour.
- returns
any: Mat handle, value or undefined
cv.copyMakeBorder(...)
Add a border around an image.
- returns
any: Mat handle, value or undefined
cv.copyTo(...)
Copy a Mat (optionally with a mask).
- returns
any: Mat handle, value or undefined
cv.cornerHarris(...)
Harris corner response.
- returns
any: Mat handle, value or undefined
cv.cornerSubPix(...)
Refine corners to sub-pixel accuracy.
- returns
any: Mat handle, value or undefined
cv.countNonZero(...)
Count non-zero pixels.
- returns
any: Mat handle, value or undefined
cv.crop(...)
Crop to {x, y, ex, ey}.
- returns
any: Mat handle, value or undefined
cv.cvtColor(...)
Color space conversion.
- returns
any: Mat handle, value or undefined
cv.detectBarcode(...)
Detect and decode barcodes → {decoded[], types[], points} or undefined.
- returns
any: Mat handle, value or undefined
cv.detectQRCode(...)
Detect and decode a QR code → {decoded, points} or undefined.
- returns
any: Mat handle, value or undefined
cv.dilate(...)
Morphological dilation.
- returns
any: Mat handle, value or undefined
cv.distanceTransform(...)
Distance transform.
- returns
any: Mat handle, value or undefined
cv.divide(...)
Per-element division.
- returns
any: Mat handle, value or undefined
cv.drawContours(...)
Draw contours.
- returns
any: Mat handle, value or undefined
cv.drawKeypoints(...)
Draw keypoints.
- returns
any: Mat handle, value or undefined
cv.drawMarker(...)
Draw a marker.
- returns
any: Mat handle, value or undefined
cv.drawMatches(...)
Draw keypoint matches.
- returns
any: Mat handle, value or undefined
cv.ellipse(...)
Draw an ellipse.
- returns
any: Mat handle, value or undefined
cv.empty(...)
Whether a Mat is empty or invalid.
- returns
any: Mat handle, value or undefined
cv.encodeQRCode(...)
Generate a QR code image (264×264 BGR).
- returns
any: Mat handle, value or undefined
cv.equalizeHist(...)
Histogram equalization.
- returns
any: Mat handle, value or undefined
cv.erode(...)
Morphological erosion.
- returns
any: Mat handle, value or undefined
cv.estimateAffine2D(...)
Estimate a 2D affine transform.
- returns
any: Mat handle, value or undefined
cv.estimateAffinePartial2D(...)
Estimate a similarity transform.
- returns
any: Mat handle, value or undefined
cv.extractChannel(...)
Extract one channel.
- returns
any: Mat handle, value or undefined
cv.fastNlMeansDenoising(...)
Non-local means denoising (gray).
- returns
any: Mat handle, value or undefined
cv.fastNlMeansDenoisingColored(...)
Non-local means denoising (color).
- returns
any: Mat handle, value or undefined
cv.fillConvexPoly(...)
Fill a convex polygon.
- returns
any: Mat handle, value or undefined
cv.fillPoly(...)
Fill polygons.
- returns
any: Mat handle, value or undefined
cv.filter2D(...)
Convolve with a custom kernel.
- returns
any: Mat handle, value or undefined
cv.findContours(...)
Find contours.
- returns
any: Mat handle, value or undefined
cv.findHomography(...)
Find a perspective homography.
- returns
any: Mat handle, value or undefined
cv.findNonZero(...)
Coordinates of non-zero pixels.
- returns
any: Mat handle, value or undefined
cv.fitEllipse(...)
Fit an ellipse to points.
- returns
any: Mat handle, value or undefined
cv.fitLine(...)
Fit a line to points.
- returns
any: Mat handle, value or undefined
cv.flannKnnMatch(...)
FLANN k-nearest-neighbour matching.
- returns
any: Mat handle, value or undefined
cv.flip(...)
Flip an image.
- returns
any: Mat handle, value or undefined
cv.floodFill(...)
Flood fill.
- returns
any: Mat handle, value or undefined
cv.fromImageId(...)
Convert an image-module imageId to a Mat.
- returns
any: Mat handle, value or undefined
cv.getAffineTransform(...)
Affine matrix from 3 point pairs.
- returns
any: Mat handle, value or undefined
cv.getPerspectiveTransform(...)
Perspective matrix from 4 point pairs.
- returns
any: Mat handle, value or undefined
cv.getRectSubPix(...)
Sub-pixel rectangle extraction.
- returns
any: Mat handle, value or undefined
cv.getRotationMatrix2D(...)
Rotation matrix.
- returns
any: Mat handle, value or undefined
cv.getSize(...)
{width, height, channels, rows, cols, type} of a Mat.
- returns
any: Mat handle, value or undefined
cv.getStructuringElement(...)
Create a morphology kernel.
- returns
any: Mat handle, value or undefined
cv.getTextSize(...)
Measure text size for putText.
- returns
any: Mat handle, value or undefined
cv.goodFeaturesToTrack(...)
Shi-Tomasi corner detection.
- returns
any: Mat handle, value or undefined
cv.hconcat(...)
Concatenate horizontally.
- returns
any: Mat handle, value or undefined
cv.imdecode(...)
Decode Base64 image data to a Mat.
- returns
any: Mat handle, value or undefined
cv.imencode(...)
Encode a Mat to Base64 (jpg/png ...).
- returns
any: Mat handle, value or undefined
cv.imread(...)
Read an image file / imageId / "screen" / URL to a BGR Mat.
- returns
any: Mat handle, value or undefined
cv.imwrite(...)
Write a Mat to an image file.
- returns
any: Mat handle, value or undefined
cv.inRange(...)
Mask of pixels inside a range.
- returns
any: Mat handle, value or undefined
cv.inpaint(...)
Inpaint a masked region.
- returns
any: Mat handle, value or undefined
cv.invertAffineTransform(...)
Invert an affine matrix.
- returns
any: Mat handle, value or undefined
cv.isContourConvex(...)
Whether a contour is convex.
- returns
any: Mat handle, value or undefined
cv.isRelease(...)
Whether a Mat handle has been released.
- returns
any: Mat handle, value or undefined
cv.knnMatch(...)
k-nearest-neighbour descriptor matching.
- returns
any: Mat handle, value or undefined
cv.line(...)
Draw a line.
- returns
any: Mat handle, value or undefined
cv.matchShapes(...)
Compare two shapes.
- returns
any: Mat handle, value or undefined
cv.matchTemplate(...)
Template matching score map.
- returns
any: Mat handle, value or undefined
cv.matchTemplateLoc(...)
Template matching best location → {x, y, minVal, maxVal}.
- returns
any: Mat handle, value or undefined
cv.max(...)
Per-element maximum.
- returns
any: Mat handle, value or undefined
cv.mean(...)
Mean of each channel.
- returns
any: Mat handle, value or undefined
cv.meanStdDev(...)
Mean and standard deviation.
- returns
any: Mat handle, value or undefined
cv.medianBlur(...)
Median blur.
- returns
any: Mat handle, value or undefined
cv.merge(...)
Merge channels.
- returns
any: Mat handle, value or undefined
cv.min(...)
Per-element minimum.
- returns
any: Mat handle, value or undefined
cv.minAreaRect(...)
Minimum-area rotated rectangle.
- returns
any: Mat handle, value or undefined
cv.minEnclosingCircle(...)
Minimum enclosing circle.
- returns
any: Mat handle, value or undefined
cv.minMaxLoc(...)
Min/max values and their locations.
- returns
any: Mat handle, value or undefined
cv.moments(...)
Image/contour moments.
- returns
any: Mat handle, value or undefined
cv.morphologyEx(...)
Advanced morphology (open, close, gradient ...).
- returns
any: Mat handle, value or undefined
cv.multiply(...)
Per-element multiplication.
- returns
any: Mat handle, value or undefined
cv.norm(...)
Matrix norm.
- returns
any: Mat handle, value or undefined
cv.normalize(...)
Normalize value range.
- returns
any: Mat handle, value or undefined
cv.ones(...)
Create a Mat of ones.
- returns
any: Mat handle, value or undefined
cv.perspectiveTransform(...)
Apply a perspective matrix to points.
- returns
any: Mat handle, value or undefined
cv.phaseCorrelate(...)
Translation between two images.
- returns
any: Mat handle, value or undefined
cv.pointPolygonTest(...)
Point position relative to a contour.
- returns
any: Mat handle, value or undefined
cv.polylines(...)
Draw polylines.
- returns
any: Mat handle, value or undefined
cv.putText(...)
Draw text.
- returns
any: Mat handle, value or undefined
cv.pyrDown(...)
Downsample (Gaussian pyramid).
- returns
any: Mat handle, value or undefined
cv.pyrUp(...)
Upsample (Gaussian pyramid).
- returns
any: Mat handle, value or undefined
cv.rectangle(...)
Draw a rectangle.
- returns
any: Mat handle, value or undefined
cv.release(...)
Release a Mat handle.
- returns
any: Mat handle, value or undefined
cv.releaseAll(...)
Release all Mat handles.
- returns
any: Mat handle, value or undefined
cv.resize(...)
Resize an image.
- returns
any: Mat handle, value or undefined
cv.rotate(...)
Rotate by 90/180/270 degrees.
- returns
any: Mat handle, value or undefined
cv.set(...)
Write one pixel ({row, col, value}).
- returns
any: Mat handle, value or undefined
cv.split(...)
Split channels.
- returns
any: Mat handle, value or undefined
cv.subtract(...)
Per-element subtraction.
- returns
any: Mat handle, value or undefined
cv.sum(...)
Sum of each channel.
- returns
any: Mat handle, value or undefined
cv.threshold(...)
Fixed threshold.
- returns
any: Mat handle, value or undefined
cv.toImageId(...)
Convert a Mat to an image-module imageId.
- returns
any: Mat handle, value or undefined
cv.vconcat(...)
Concatenate vertically.
- returns
any: Mat handle, value or undefined
cv.warpAffine(...)
Apply an affine transform.
- returns
any: Mat handle, value or undefined
cv.warpPerspective(...)
Apply a perspective transform.
- returns
any: Mat handle, value or undefined
cv.zeros(...)
Create a Mat of zeros.
- returns
any: Mat handle, value or undefined
console — console
Standard console object (JavaScript). log/info/debug write info-level lines, warn/error write warning/error lines; table/dir/trace/assert also log; group*, count*, time*, profile*, clear, record*, timeStamp, takeHeapSnapshot and screenshot are no-ops. Inside a running script package, console provides only log/info/warn/error/debug.
Modes: agent, hid
jbclear — Jailbreak: data cleanup
Requires a jailbroken environment; not available in the TestFlight build.
jbclear.keychain(identifier)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
identifier(any): —- returns
—: Not available
jbclear.allKeychain()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbclear.cookies()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbclear.caches(options?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
options(any, optional): —- returns
—: Not available
jbclear.photos()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbclear.appData(bundleId)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
bundleId(any): —- returns
—: Not available
jbclear.getIdfa()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbclear.resetIdfa()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbclear.setIdfa(value)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
value(any): —- returns
—: Not available
jbclear.getIdfv(bundleId)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
bundleId(any): —- returns
—: Not available
jbclear.resetIdfv(bundleId)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
bundleId(any): —- returns
—: Not available
jbclear.setIdfv(bundleId, value)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
bundleId(any): —value(any): —- returns
—: Not available
jbdevice — Jailbreak: device settings
Requires a jailbroken environment; not available in the TestFlight build.
jbdevice.setAutoLockMinutes(minutes)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
minutes(any): —- returns
—: Not available
jbdevice.restoreAutoLock()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.getAutoLockMinutes()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.serialNumber()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.wifiMac()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.wifiInfo()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.wifiOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.wifiOff()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.isWifiOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.bluetoothOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.bluetoothOff()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.isBluetoothOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.cellularOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.cellularOff()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.isCellularOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.airplaneOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.airplaneOff()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.isAirplaneOn()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.joinWifi(ssid, password?, timeoutMs?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
ssid(any): —password(any, optional): —timeoutMs(any, optional, default 0): —- returns
—: Not available
jbdevice.forgetWifi(ssid)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
ssid(any): —- returns
—: Not available
jbdevice.listWifi()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.scanWifi(timeoutMs?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
timeoutMs(any, optional, default 0): —- returns
—: Not available
jbdevice.setVolume(volume)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
volume(any): —- returns
—: Not available
jbdevice.getVolume()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdevice.setBrightness(brightness)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
brightness(any): —- returns
—: Not available
jbdevice.getBrightness()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdraw — Jailbreak: screen overlay drawing
Requires a jailbroken environment; not available in the TestFlight build.
jbdraw.rect(x, y, width, height, options?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
x(any): —y(any): —width(any): —height(any): —options(any, optional): —- returns
—: Not available
jbdraw.text(x, y, text, options?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
x(any): —y(any): —text(any): —options(any, optional): —- returns
—: Not available
jbdraw.clear(id)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
id(any): —- returns
—: Not available
jbdraw.clearAll()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbdylib — Jailbreak: dynamic libraries
Requires a jailbroken environment; not available in the TestFlight build.
jbdylib.open(name, defs?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
name(any): —defs(any, optional): —- returns
—: Not available
jbdylib.isLoaded(name)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
name(any): —- returns
—: Not available
jbpower — Jailbreak: power / charging
Requires a jailbroken environment; not available in the TestFlight build.
jbpower.info()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbpower.stopCharging()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbpower.startCharging()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbpower.setSmartCharging(min, max)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
min(any): —max(any): —- returns
—: Not available
jbpower.clearSmartCharging()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbshell — Jailbreak: shell
Requires a jailbroken environment; not available in the TestFlight build.
jbshell.exec(command, timeoutMs?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
command(any): —timeoutMs(any, optional): —- returns
—: Not available
jbsystem — Jailbreak: system control
Requires a jailbroken environment; not available in the TestFlight build.
jbsystem.respring()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbsystem.reboot()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbsystem.restartSelf()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbsystem.getUserTracking()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbsystem.setUserTracking(enabled)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
enabled(any): —- returns
—: Not available
jbsystem.getPersonalizedAdvertising()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbsystem.setPersonalizedAdvertising(enabled)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
enabled(any): —- returns
—: Not available
jbsystem.getLocationServices()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbsystem.setLocationServices(enabled)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
enabled(any): —- returns
—: Not available
jbsystem.jbroot(path)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
path(any): —- returns
—: Not available
jbsystem.rootfs(path)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
path(any): —- returns
—: Not available
jbvpn — Jailbreak: VPN
Requires a jailbroken environment; not available in the TestFlight build.
jbvpn.create(config)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
config(any): —- returns
—: Not available
jbvpn.list()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbvpn.current()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbvpn.select(nameOrId)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
nameOrId(any): —- returns
—: Not available
jbvpn.remove(nameOrId)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
nameOrId(any): —- returns
—: Not available
jbvpn.connect(nameOrId?)
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
nameOrId(any, optional): —- returns
—: Not available
jbvpn.disconnect()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available
jbvpn.status()
Requires a jailbroken environment; not available in the TestFlight build. [unsupported]
- returns
—: Not available