Runtime V2 API Catalog
57 entriesComplete listing of classes, collections, and built-in automation functions available in CogniTab Script Runtime.
📦 Classes
15 entries- →
AudioClassAudio(name)A read-only audio value for recognizing sounds in an app or game. Use Audio(name) to load a saved sample, or Audio.recent(duration_ms) to copy recently captured audio. Capture and matching run on the device; continuous listening buffers are never uploaded and scripts cannot access raw audio (PCM).
- →
ColorClassColor(value, /)Represents one ARGB color and provides color sampling/comparison helpers.
- →
MacroPanelClassMacroPanel(title="", subtitle="", confirm_text="Run", cancel_text="Cancel", *, version="")Build and show a runtime input panel for script-controlled macro parameters.
- →
OverlayTextClassOverlayText(text="", position=(0, 0), color="#FFFFFFFF", size=16, background=None)Draw text on top of the screen with optional interaction tracking (press/move/hold). Setter names such as text/background are methods; read current values through state().
- →
PointClassPoint(x, y, /, scale="fixed", anchor="none")A point on the screen, measured in pixels. Scale/anchor control coordinate mapping across screen sizes. After mapping and offsets, runtime consumers clamp the final point to the current screen's valid pixel range. Point can be destructured as x, y.
- →
RegionClassRegion(x, y, width, height, /, scale="fixed", anchor="none", scale_param=ScaleParam())A rectangular region on the screen, measured in pixels on the current screen axes. Scale/anchor control coordinate mapping across full-screen sizes without rotating through portrait coordinates or using the app viewport; runtime consumers clip the final region to the current screen after mapping and offsets. ScaleParam controls template matching inside this region. Region can be destructured as x, y, width, height.
- →
ScaleParamClassScaleParam(grayscale=True, auto_scale=False, cache_scale=True, template_scale="SHORT_EDGE", fast_matching=False)Template matching parameters for Region. fast_matching downsamples both the Region image and template.
- →
ScreenCaptureClassScreenCaptureStatic controls for shared screen capture during the current macro run. Automatic caching normally reuses frames for up to 100 ms to reduce capture work. For rapid recognition that needs the freshest available frame, use auto_cache_off(); this increases processing and battery use and does not guarantee faster execution or newly rendered pixels. Explicit cache_on() pins a frame separately and takes priority over automatic-cache settings.
- →
StorageClassStorageStatic persistent key/value storage for the current macro. Normal variables stay shared only between sequential PYTHON_CODE actions within the same flow, including actions inside GROUP wrappers; parallel flows keep isolated variables. Storage keys are shared across all flows, so use Storage when values must survive the next macro run, not as inter-process messaging. Writes are autosaved after 2 seconds of idle time and committed again after the whole macro Run and all background flows end.
- →
SwipePointClassSwipePoint(point, speed="NORMAL", delay_before=0, random=10, humanized=False, scale="fixed", anchor="none")One point inside a flat swipe path. The point must be a Point or tuple (x, y). Pass a list of at least two SwipePoint values to swipe([...]) to move one finger through multiple points.
- →
SystemClassSystem()Access runtime system/device info and trigger system-level actions from script.
- →
TemplateClassTemplate(name, /)Template image wrapper. You can scale/crop an existing template, save it as a new template name, or check existence.
- →
TfliteModelClassTfliteModel(model)TFLite model handle for scripts. The model type must be selected in Template Manager metadata. Supported outputs are YOLOv8/YOLO11 object detection [1,N,4+C]/[1,4+C,N], YOLO26 end-to-end detection [1,N,6]/[N,6], YOLO11/YOLO26 image classification [1,C], and MobileNetV3 image classification [1,C]. Runtime detects FLOAT32, INT8, or UINT8 tensor precision from the model and dequantizes quantized detection and classification outputs before applying thresholds. Classification matches return class confidence and metadata without point or bounds. Inference methods require a local model file; when local file is missing and runtime download fails, script raises a runtime error.
- →
TimerClassTimer(auto_start=True)Millisecond stopwatch helper for script timing checks and guarded waits.
- →
TouchClassTouchStatic helper for parallel click/swipe actions created by the UI or code via click(..., parallel=True) and swipe(..., parallel=True). You can collect click/swipe actions and send them together, or inspect click/swipe actions that are active or queued. The helper also supports cancelling active click/swipe actions (Android 8.0+ only).
🔒 Read-only Classes
6 entries- →
AudioMatchRead-only ClassAudioMatchRead-only audio match result. Score is similarity, not an accuracy probability. find() timestamps use the listening session timeline; match() uses the searched audio value's timeline. Compare timestamps to avoid handling one sound repeatedly. Only use timestamps as detections when matched is True.
- →
FlowRead-only ClassFlowStatic controls for starting named macro flows in parallel. At most two background flows can run beside the main flow, and only one live invocation of a given named flow is allowed, including while it is paused or stopping. Flow.start() returns immediately after the coordinator accepts the branch; background flows may start peer flows. Variables are isolated per branch and never merge into the caller. The main flow waits for all background flows before Run completes. An invalid or duplicate name, a full background-flow limit, any branch error, System.stop(), or Main Stop ends the whole macro. Each numbered background dock control can temporarily Pause or Resume only that branch; it has no per-branch Stop. Main Pause or Resume applies to every branch, and global Resume also clears branch-local pause flags. Touch gestures from different branches can cancel each other. ScreenCapture and audio capture policies are shared globally. Storage shares the same persistent keys across branches and is not an inter-process messaging channel.
- →
MatchRead-only ClassMatchRead-only recognition match result returned by region.find* helpers. In a recognition Success branch, Recognition.result points to the active Match or MatchList.
- →
MatchListRead-only ClassMatchListA read-only list of Match values returned by region.find_any/find_all/find_multi, wait_any/wait_all, and Recognition.result when multiple recognition targets matched.
- →
RecognitionRead-only ClassRecognitionUsed in the recognition success branch in the UI. Recognition.result returns the Match for one recognition target or MatchList when multiple targets matched.
- →
TouchStateRead-only ClassTouchState(id, status, kind, action_order, remaining_repeats, completed_repeats)Snapshot of one script/UI touch item in the shared gesture queue.
📚 Collections
5 entries- →
dictCollectiondict(mapping_or_pairs=(), /, **items)A key/value collection that keeps insertion order and can be read or updated during script execution.
- →
listCollectionlist(iterable=(), /)An ordered collection you can create, read, loop through, destructure, and update while the script runs.
- →
setCollectionset(iterable=None, /)A mutable collection of unique values. CogniTab keeps iteration order stable so script output is easy to read.
- →
StringCollectionStringText value collection. Created by string literals or str(value), then read by length/index/loop operations.
- →
tupleCollectiontuple(iterable=(), /) (value1, value2, ...)An ordered read-only collection. Use tuple literals when values should stay fixed after creation or when returning grouped values for destructuring.
⚡ Functions
31 entriesGesture
2 entries- →
clickFunctionclick(target, hold_ms=0, offset=(0, 0), random=0, delay_before=0, delay_after=0, parallel=False)Click on a Point, (x, y) tuple, Match, or MatchList. Every parameter supports positional or named form in the documented order. Use Point(x, y) for coordinate metadata such as scale/anchor; use (x, y) for fixed pixel coordinates. Use parallel=True to queue this touch and receive its numeric id; call Touch.cancel(id) or Touch.cancel() to cancel queued/active touches.
- →
swipeFunctionswipe(points, *, parallel=False)Perform a swipe gesture from a flat list of SwipePoint values. Each list creates one multi-point path for one finger.
Flow Control
5 entries- →
printFunctionprint(*values, sep=" ", end="\n")Write values to the overlay script console without blocking execution. Structured values use the same bounded display formatter as str(value), including row-based pretty output for two-dimensional lists, multi-line output for complex nesting, and explicit markers when content is omitted.
- →
randomFunctionrandom()Return a random floating-point number in the 0 -> 1 range.
- →
random_intFunctionrandom_int(min, max, /)Return a random integer in the inclusive min -> max range.
- →
rangeFunctionrange(stop, /) | range(start, stop, step=1, /)Generate a sequence of integers for use in for-loops.
- →
waitFunctionwait(ms, /)Pause script execution for a given number of milliseconds.
Collections
4 entries- →
enumerateFunctionenumerate(iterable, start=0)Return a list of tuple(index, item) pairs for any iterable value.
- →
lenFunctionlen(value, /)Get size of a String, list/tuple, or dict.
- →
sortedFunctionsorted(iterable, /, *, key=None, reverse=False)Return a new list containing all items from iterable in sorted order. key can compute comparison keys; reverse=True sorts descending while keeping equal-key items stable.
- →
zipFunctionzip(*iterables)Combine iterables into a list of tuples, stopping at the shortest input.
Type Conversion
5 entries- →
boolFunctionbool(value, /)Convert value to boolean using script truthy/falsy rules.
- →
floatFunctionfloat(value, /)Cast value to floating-point number.
- →
intFunctionint(value, /)Cast value to integer (truncates decimal part).
- →
strFunctionstr(value, /)Convert value to string using DSL display format. Point/Region stay compact, two-dimensional lists render as one row list per line, and only rows that are too long or complex expand into vertical multi-line text. Large or deeply nested structured values use a bounded preview with explicit omitted/budget markers; a direct string value remains unchanged.
- →
typeFunctiontype(value, /)Return the Python-like class descriptor string for a value, for example <class 'int'>.
Math
14 entries- →
absFunctionabs(value, /)Return absolute value.
- →
ceilFunctionceil(value, /)Return smallest integer not smaller than value.
- →
clampFunctionclamp(value, min, max, /)Clamp value into the min -> max range.
- →
cosFunctioncos(value, /)Return cosine of value in radians.
- →
floorFunctionfloor(value, /)Return largest integer not greater than value.
- →
logFunctionlog(value, base=None, /)Return logarithm of value. Uses natural log when base is omitted.
- →
maxFunctionmax(iterable, /, *, key=None) | max(iterable, /, *, default, key=None) | max(arg1, arg2, /, *args, key=None)Return the largest item from one iterable or the largest of two or more arguments. key can compute the value used for ordering; ties keep the first item encountered.
- →
minFunctionmin(iterable, /, *, key=None) | min(iterable, /, *, default, key=None) | min(arg1, arg2, /, *args, key=None)Return the smallest item from one iterable or the smallest of two or more arguments. key can compute the value used for ordering; ties keep the first item encountered.
- →
powFunctionpow(base, exponent, /)Raise base to exponent.
- →
roundFunctionround(value, digits=0, /)Round value to a given number of decimal digits.
- →
sinFunctionsin(value, /)Return sine of value in radians.
- →
sqrtFunctionsqrt(value, /)Return square root of a non-negative value.
- →
sumFunctionsum(iterable, /, start=0)Return the numeric sum of an iterable, optionally starting from start. A generator expression can omit its own parentheses only when it is the sole argument of a function or method call; extra arguments or a trailing comma require parentheses around the generator.
- →
tanFunctiontan(value, /)Return tangent of value in radians.