Runtime V2 API Catalog
60 entriesComplete listing of classes, collections, and built-in automation functions available in CogniTab Script Runtime.
📦 Classes
16 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, /)Store a color, sample colors from the screen, or compare colors. ARGB contains opacity (A), red (R), green (G), and blue (B); compare(), distance_rgb(), and delta_e() ignore opacity.
- →
MacroPanelClassMacroPanel(title="", subtitle="", confirm_text="Run", cancel_text="Cancel", *, version="")Create a panel to collect macro settings from the user. Add fields, then call show() to display it.
- →
MotionTrackerClassMotionTracker(region=None, exclude=None, max_displacement=80, max_gap_ms=850, max_frame_age_ms=250)Track background translation between screen frames using native OpenCV multi-patch matching. Construction does not capture a frame; at most 16 trackers may be open per flow. This does not detect a player or locate an atlas. Exclude the HUD and character; handle game zoom externally with template matching and scale. Suspected zoom or rotation produces LOST, not a zoom estimate.
- →
OverlayTextClassOverlayText(text="", position=(0, 0), color="#FFFFFFFF", size=16, background=None)Create text over other apps. Call show() to display it and to apply later changes. Enable press, drag or hold tracking with track(). Read current values with state(); text() and background() are methods.
- →
PointClassPoint(x, y, /, scale="fixed", anchor="none")A screen position in pixels, used for clicks, swipes and highlights. Scale and anchor adapt the position to another screen size; the final position is kept within the screen. Read both coordinates with x, y = point.
- →
RegionClassRegion(x, y, width, height, /, scale="fixed", anchor="none", scale_param=ScaleParam())A rectangular screen area for finding images or colors, capturing an image, or drawing an outline. Coordinates use pixels on the current horizontal/vertical axes; after scaling and offsets, only the part inside the screen is used. Read its dimensions with x, y, width, height = region.
- →
ScaleParamClassScaleParam(grayscale=True, auto_scale=False, cache_scale=True, template_scale="SHORT_EDGE", fast_matching=False)Settings for finding template images inside a Region. Pass this object as the Region's scale_param; these settings do not change the region's coordinates.
- →
ScreenCaptureClassScreenCaptureControl whether screen recognition reuses captured images during the current macro run. Normally, a captured image can be reused for up to 100 ms. Call these methods directly on ScreenCapture; do not create an instance.
- →
StorageClassStorageSave named values for the current macro to use in later runs. All flows in the same run share Storage; ordinary variables are shared only by sequential PYTHON_CODE actions in one flow, including GROUP actions. Parallel flows have separate variables. Storage is not a messaging channel between processes.
- →
SwipePointClassSwipePoint(point, speed="NORMAL", delay_before=0, random=10, humanized=False, scale="fixed", anchor="none")A position and movement settings for one step of a swipe. Pass a list of at least two SwipePoint objects to swipe([...]) to move one finger through those positions.
- →
SystemClassSystem()Access runtime system/device info and trigger system-level actions from script.
- →
TemplateClassTemplate(name, /)Use a saved image as a recognition target. You can resize or crop it into a separate Template, then save the result with save_as().
- →
TfliteModelClassTfliteModel(model)Use a TFLite model imported in Template Manager to recognize objects or classify an image. Select the correct model type there. Supported outputs: YOLOv8/YOLO11 detection [1,N,4+C]/[1,4+C,N]; YOLO26 detection [1,N,6]/[N,6]; YOLO11/YOLO26 and MobileNetV3 classification [1,C]. FLOAT32, INT8 and UINT8 are supported automatically. Classification returns class scores and metadata without screen points or bounds. Inference requires a local model file; failure to obtain it raises an error.
- →
TimerClassTimer(auto_start=True)Measure elapsed time in milliseconds. Pause and resume without losing the time already counted.
- →
TouchClassTouchManage parallel clicks and swipes from scripts or macro actions: group them, inspect their progress, wait or cancel. In scripts, use click(..., parallel=True) or swipe(..., parallel=True). Sending gestures requires CogniTab's Accessibility service to be enabled.
🔒 Read-only Classes
7 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 ClassFlowRun named macro flows in parallel and send messages between them. Each flow has its own variables. Pass starting data with Flow.params; messages are independent copies read in the order sent.
- →
MatchRead-only ClassMatchRead the result of a recognition search. Check found before clicking or using its location; a failed image search can still contain the best candidate's location.
- →
MatchListRead-only ClassMatchListRead several recognition results as a list of Match values. Use len(matches), matches[index], or a for loop. A non-empty list can include failed matches, especially after wait_any()/wait_all(); check each item's found value.
- →
MotionResultRead-only ClassMotionResultRead-only result from MotionTracker.update(). Translation describes background motion between frames, not absolute location. Tracking does not click, send input, upload or save data.
- →
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)The state of a parallel click or swipe when it was queried. Obtain it from Touch methods; it does not update automatically.
📚 Collections
6 entries- →
dictCollectiondict(mapping_or_pairs=(), /, **items)Store values under keys and read them by key. Keys keep insertion order; writing an existing key replaces its value without moving the key. Each key has one value.
- →
listCollectionlist(iterable=(), /)Store items in order, including repeated values. Read positions starting at 0, loop through items, or add, replace and remove items in the same list.
- →
rangeCollectionrange(stop, /) | range(start, stop, step=1, /)An immutable sequence of integers created with range(). You can reuse it without creating a full list; use list() when you need a list.
- →
setCollectionset(iterable=(), /)Store values without duplicates and add or remove them later. Equal values appear only once: True, 1 and 1.0 are equal. Items must be usable as dictionary keys; a list, dictionary, set or tuple containing one of them is rejected. Do not rely on iteration order.
- →
StringCollectionStringStore text written in quotes or converted with str(value). Strings cannot be changed in place; string methods return new values. Positions and length count Unicode code points: an emoji is one position, but a letter with a separate accent or a joined emoji can use several.
- →
tupleCollectiontuple(iterable=(), /) (value1, value2, ...)Store ordered items, including duplicates, without adding, removing or replacing them after creation. A nested list or dictionary can still change. In conditions, an empty tuple is false and a non-empty tuple is true.
⚡ Functions
31 entriesGesture
2 entries- →
clickFunctionclick(target, hold_ms=0, offset=(0, 0), random=0, delay_before=0, delay_after=0, parallel=False)Press and release each target point. By default, wait for the click to finish before continuing. Parameters accept positional or named arguments in the documented order.
- →
swipeFunctionswipe(points, *, parallel=False)Move one finger through the SwipePoint values in order. By default, wait for the swipe to finish before continuing.
Input
1 entryFlow Control
5 entries- →
printFunctionprint(*values, sep=" ", end="\n")Write values to the overlay script console and continue execution. Values use the same text as str(value).
- →
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)Number input items as you loop over them.
- →
lenFunctionlen(value, /)Get size of a String, list/tuple, or dict.
- →
sortedFunctionsorted(iterable, /, *, key=None, reverse=False)Return a new list sorted from smallest to largest. Items with equal comparison values keep their original order, even with reverse=True.
- →
zipFunctionzip(*iterables, strict=False)Pair items at the same position in each input as you loop.
Type Conversion
5 entries- →
boolFunctionbool(value=False, /)Convert value to True or False for use in conditions.
- →
floatFunctionfloat(value=0.0, /)Convert value to a decimal number. Text must contain a valid number; True becomes 1.0 and False becomes 0.0.
- →
intFunctionint(value=0, /)Convert value to an integer, discarding the decimal part of numeric inputs. Text must contain an integer; decimal text raises an error. True becomes 1 and False becomes 0.
- →
strFunctionstr(value="", /)Convert value to text. Existing strings stay unchanged; numbers and built-in collections use Python text notation.
- →
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, /)Keep value between min and max: replace values outside the range with the nearest boundary. Reversed boundaries are accepted.
- →
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(number, ndigits=None)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)Add the input numbers to start and return the total.
- →
tanFunctiontan(value, /)Return tangent of value in radians.