quickadd icon indicating copy to clipboard operation
quickadd copied to clipboard

Add macro command to reset/clear variables

Open chhoumann opened this issue 6 months ago • 0 comments

Summary

Add a macro command that can reset or clear specific variables or all variables during macro execution.

Problem

Variables persist throughout macro execution, which can cause issues when:

  • Reusing macros with stale variable data
  • Conditional logic depends on clean variable state
  • Testing macros with different variable combinations
  • Error conditions leave variables in unexpected states

Proposed Solution

Add a new macro command type: Reset Variables Command

Options:

  • Reset All Variables: Clear all current variables
  • Reset Specific Variables: Choose which variables to clear
  • Reset Variable Pattern: Clear variables matching a pattern (e.g., temp_*)

Implementation Ideas

  • Add to macro command dropdown alongside existing commands
  • Simple UI to select variables to reset
  • Could be combined with conditional logic for advanced workflows

Use Cases

  • Start macro sections with clean variable state
  • Clear temporary variables between macro steps
  • Reset variables before calling nested macros
  • Error handling - clear corrupted variable data

Benefits

  • More predictable macro behavior
  • Better debugging capabilities
  • Cleaner macro design patterns
  • Reduced variable namespace pollution

chhoumann avatar May 29 '25 14:05 chhoumann