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.
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.
Example
# Restore a persisted counter with a fallback default
run_count = Storage.get("run_count", 0)
Storage.set
Static Method
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.
Syntax
Storage.set(key, value)
Parameters
Name
Description
keyAny
Key to write.
Required · Positional or named
No default
valueAny?
Value to persist for that key.
Required · Positional or named
No default
Returns
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.
Example
# Persist values for the next macro run
Storage.set("run_count", 3)
Storage.set("last_point", Point(500, 900))
Storage.remove
Static Method
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.
Example
# Drop a persisted flag when it is no longer needed
old_flag = Storage.remove("boost_enabled")
Storage.contains
Static Method
Check whether a persisted key currently exists.
Syntax
Storage.contains(key)
Parameters
Name
Description
keyAny
Key to test.
Required · Positional or named
No default
Returns
Boolean — `True` when the key exists, otherwise `False`.
Example
# Guard logic based on persisted state
if Storage.contains("last_point"):
MacroPanel.notify("Saved point is ready")
Storage.keys
Static Method
Get all persisted keys as a list in insertion order.
# Read all persisted values for quick inspection
saved_values = Storage.values()
Storage.clear
Static Method
Remove every persisted entry for the current macro.
Syntax
Storage.clear()
Returns
None — No direct return value. The storage becomes empty.
Example
# Reset all persisted Storage values
Storage.clear()
Storage.to_dict
Static Method
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.
Syntax
Storage.to_dict()
Returns
dict — A live dict view of the current persisted storage entries.
Example
# Read and update the full persisted storage dictionary
state = Storage.to_dict()
state["bonus"] = 5
MacroPanel.notify(str(state))