diff --git a/macro_manager.py b/macro_manager.py index cfda352..a180a58 100644 --- a/macro_manager.py +++ b/macro_manager.py @@ -1,5 +1,6 @@ # Macro management and execution with command sequence support +import copy import json import os import uuid @@ -163,11 +164,11 @@ class MacroManager: # Process image if provided image_path_reference = self._process_image(image_path) if image_path else "" - # Create macro data + # Create macro data (deep copy commands to avoid reference issues) macro_data = { "name": name, "type": "sequence", - "commands": commands, + "commands": copy.deepcopy(commands), "category": category, "image_path": image_path_reference, "last_used": 0 @@ -197,11 +198,11 @@ class MacroManager: else: image_path_reference = macro.get("image_path", "") - # Update macro data + # Update macro data (deep copy commands to avoid reference issues) self.macros[macro_id] = { "name": name, "type": "sequence", - "commands": commands, + "commands": copy.deepcopy(commands), "category": category, "image_path": image_path_reference, "last_used": macro.get("last_used", 0)