Static persistent key/value storage for the current macro.
Syntax
Storage
This class cannot be constructed directly.
Parameters
None
Returns
—
Behavior / side effects
Static 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.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Read one persisted value by key and optionally fall back to a default when the key is missing.
Syntax
Storage.get(key, default=None)
Parameters
Name
Description
keyAny
Key to look up.
Required · Positional or named
No default
defaultAny?
Fallback value returned when the key is missing.
Optional · Positional or named
Default:None
Returns
Any? — The stored value for that key, or the provided default.
Behavior / side effects
Read one persisted value by key and optionally fall back to a default when the key is missing.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Restore a persisted counter with a fallback default
run_count = Storage.get("run_count", 0)
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
None — No direct return value. The storage is updated in place, autosaved after 2 seconds of idle time, and committed again after the whole macro Run and all background flows end.
Behavior / side effects
Write or replace one entry in persistent storage. Supported values keep script-friendly types such as Number, String, Boolean, Point, Region, list, tuple, dict, set, and None, including nested collection values.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Persist values for the next macro run
Storage.set("run_count", 3)
Storage.set("last_point", Point(500, 900))
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Remove one persisted entry and return the old value.
Syntax
Storage.remove(key)
Parameters
Name
Description
keyAny
Key to remove.
Required · Positional or named
No default
Returns
Any? — The removed value, or None when the key was missing.
Behavior / side effects
Remove one persisted entry and return the old value.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Drop a persisted flag when it is no longer needed
old_flag = Storage.remove("boost_enabled")
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Boolean — `True` when the key exists, otherwise `False`.
Behavior / side effects
Check whether a persisted key currently exists.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Guard logic based on persisted state
if Storage.contains("last_point"):
MacroPanel.notify("Saved point is ready")
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Get all persisted keys as a list in insertion order.
Syntax
Storage.keys()
Parameters
None
Returns
list — A list of persisted keys.
Behavior / side effects
Get all persisted keys as a list in insertion order.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Inspect which values are persisted for this macro
saved_keys = Storage.keys()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Get all persisted values as a list in insertion order.
Syntax
Storage.values()
Parameters
None
Returns
list — A list of persisted values.
Behavior / side effects
Get all persisted values as a list in insertion order.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Read all persisted values for quick inspection
saved_values = Storage.values()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Remove every persisted entry for the current macro.
Syntax
Storage.clear()
Parameters
None
Returns
None — No direct return value. The storage becomes empty.
Behavior / side effects
Remove every persisted entry for the current macro.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Reset all persisted Storage values
Storage.clear()
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.
Return the current storage as a live dict shared by every flow in this Run.
Syntax
Storage.to_dict()
Parameters
None
Returns
dict — A live dict view of the current persisted storage entries.
Behavior / side effects
Return the current storage as a live dict shared by every flow in this Run. Direct edits to entries in the returned dictionary join the autosave flow, and the latest live snapshot is committed after the whole macro Run and all background flows end.
Execution
Blocking: Conditional
Thread safety: Serialized
Parallel execution: Conditional
Flows in one Run share the same Storage session. Individual operations and tracked nested mutations are locked. A get followed by set is not an atomic transaction; assign a single writer when updates depend on earlier reads.
Example
# Read and update the full persisted storage dictionary
state = Storage.to_dict()
state["bonus"] = 5
MacroPanel.notify(str(state))
Errors / limitations
No additional limitations documented; follow the parameter and behavior contract above.