Runtime v2.81 · Updated Sep 30, 2026

System

Access runtime system/device info and trigger system-level actions from script.

Syntax

System()

Parameters

None

Returns

System

Behavior / side effects

Access runtime system/device info and trigger system-level actions from script.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

sys = System()
print("sdk=", sys.sdk())
battery = System.battery()
print("battery=", battery.percent, battery.charging)
System.toast("Macro started")
System.play_noti()
System.home()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

None

Fields

NameDescription
devdict
Device capability info (`isEmulator`, `sdk`, `language`, `darkmode`, `touch`, `capture`).
batterydict
Battery info (`percent`, `charging`, `temperature`, `health`).
screendict
Screen info (`width`, `height`, `orientation`, `density`, `dpi`); `orientation` is display rotation in degrees: `0`, `90`, `180`, or `270`.
memorydict
Memory info (`avail`, `total`, `threshold`, `low`).

Methods

20 methods

System.time_ms

Get current timestamp in milliseconds.

Syntax

System.time_ms()

Parameters

None

Returns

Number — Epoch milliseconds.

Behavior / side effects

Get current timestamp in milliseconds.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
started = System.time_ms()
wait(100)
print(System.time_ms() - started)

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.app_version

Get app version name.

Syntax

System.app_version()

Parameters

None

Returns

String — App version name.

Behavior / side effects

Get app version name.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.app_version())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.variant

Get the stable code of the macro variant selected for this run.

Syntax

System.variant()

Parameters

None

Returns

String — Variant code such as `default` or `pro_plus`.

Behavior / side effects

Get the stable code of the macro variant selected for this run.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Branch by the current macro variant
if System.variant() == "pro_plus":
    print("Pro Plus")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.open

Open the launchable activity of an installed Android app.

Syntax

System.open(package_name)

Parameters

NameDescription
package_nameString
Android application package name, for example `com.android.settings`.
Required · Positional or named
No default

Returns

Boolean — `True` when Android accepts a launch intent; `False` when the app is unavailable, has no launchable activity, or cannot be opened.

Behavior / side effects

Open the launchable activity of an installed Android app. CogniTab resolves the standard or Android TV launcher activity from the package name, so the activity class is not required.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Open Android Settings and handle an unavailable target
opened = System.open("com.android.settings")
if not opened:
    System.toast("App is unavailable")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.sdk

Get Android SDK int.

Syntax

System.sdk()

Parameters

None

Returns

Number — Android SDK version integer.

Behavior / side effects

Get Android SDK int.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.sdk())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.language

Get current language code.

Syntax

System.language()

Parameters

None

Returns

String — Locale language code (for example `en`, `vi`).

Behavior / side effects

Get current language code.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.language())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.dpi

Get current screen DPI.

Syntax

System.dpi()

Parameters

None

Returns

Number — Display density DPI.

Behavior / side effects

Get current screen DPI.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.dpi())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.darkmode

Check if dark mode is enabled.

Syntax

System.darkmode()

Parameters

None

Returns

Boolean — `True` when dark mode is active.

Behavior / side effects

Check if dark mode is enabled.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
if System.darkmode():
    print("Dark mode")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.play_noti

Play system notification sound.

Syntax

System.play_noti()

Parameters

None

Returns

None — No return value.

Behavior / side effects

Play system notification sound.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
System.play_noti()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.toast

Show system toast message.

Syntax

System.toast(text)

Parameters

NameDescription
textAny
Toast text or structured value to display compactly.
Required · Positional or named
No default

Returns

None — No return value.

Behavior / side effects

Show system toast message. Structured values are rendered with the compact DSL display formatter so the toast stays short and readable.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
System.toast("Macro started")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.stop

Stop the current macro immediately from script.

Syntax

System.stop()

Parameters

None

Returns

None — Stops execution; no return value is observed.

Behavior / side effects

Stop the current macro immediately from script.

Execution

  • Blocking: No
  • Thread safety: Serialized
  • Parallel execution: No

Stops the whole macro Run, including background flows. Execution does not continue after this call; it is not a per-flow cancellation API.

Example

# Query Android or request a documented system action
if Storage.get("stop_requested", False):
    System.stop()
print("Still running")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.minimized_dock

Query or adjust the minimized overlay dock.

Syntax

System.minimized_dock(point=None, *, width=None, height=None, alpha=None, mode=None)

Parameters

NameDescription
pointPoint?
Optional top-left dock position.
Optional · Positional or named
Default: None
widthNumber?
Optional minimized dock footprint width in pixels.
Optional · Keyword only
Default: None
heightNumber?
Optional minimized dock footprint height in pixels.
Optional · Keyword only
Default: None
alphaNumber?
Optional dock opacity from 0.2 to 1.0.
Optional · Keyword only
Default: None
modeString?
Optional dock presentation. Values: icon or row.
Optional · Keyword only
Default: None

Returns

dict — Applied state with `applied`, `x`, `y`, `width`, `height`, `alpha`, `mode`, and optional `reason`.

Behavior / side effects

Query or adjust the minimized overlay dock. The point uses the same coordinate scale and anchor rules as Point-based click targets; width and height are current-screen pixels.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Move, resize, and collapse the minimized dock for this run
System.minimized_dock(Point(24, 120), width=72, height=36, alpha=0.85, mode="icon")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.back

Perform global Back action.

Syntax

System.back()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Perform global Back action.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.back())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.home

Perform global Home action.

Syntax

System.home()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Perform global Home action.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.home())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.recent

Open recents screen.

Syntax

System.recent()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Open recents screen.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.recent())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.noti

Open notifications shade.

Syntax

System.noti()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Open notifications shade.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.noti())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.lockscreen

Lock the current screen.

Syntax

System.lockscreen()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Lock the current screen.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.lockscreen())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.powerdialog

Open power dialog.

Syntax

System.powerdialog()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Open power dialog.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.powerdialog())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.quicksetting

Open quick settings panel.

Syntax

System.quicksetting()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Open quick settings panel.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.quicksetting())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

System.screenshot

Trigger global screenshot action.

Syntax

System.screenshot()

Parameters

None

Returns

Boolean — `True` if action dispatched.

Behavior / side effects

Trigger global screenshot action.

Execution

  • Blocking: Conditional
  • Thread safety: Not guaranteed
  • Parallel execution: Conditional

Execution cost and waits depend on the documented operation. Keep mutable values in their owning flow; sharing arbitrary objects between flows has no general thread-safety guarantee.

Example

# Query Android or request a documented system action
print(System.screenshot())

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs