DocsVariablesAssign Variable

Assign a value to a variable from several sources in RunMacro

Desktop ModeBrowser ModeRunMacro RunnerRunMacro 3.5+

The Assign Variable command sets a new value for a variable, taken from one of three sources: typed text, the clipboard, or another variable.

Dialog & quick setup

RunMacro Assign Variable command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Assign Variable command in RunMacro.
  1. Add a Variables › Assign Variable command.
  2. Choose the target variable.
  3. Choose the source: Text / Clipboard / Another variable, then enter the source value.
  4. Save.

Options reference

Target variable

The variable to receive the new value. If missing, it is created (Dynamic).

Source (Text / Clipboard / Variable)

Where to take the value from: typed, the clipboard, or another variable.

Source value

For Text: the content (may contain variables). For Variable: the source variable name.

Modes & when to use

Desktop Mode
Browser Mode

Runs in the background through Chrome CDP: when the source is the clipboard, the command reads RunMacro’s virtual clipboard instead of the system clipboard.

RunMacro Runner

Best for

  • Update a variable with freshly copied content (clipboard).
  • Copy a value from one variable to another.
  • Reset a variable with new text.

Use an alternative when

  • Do not use it for calculations, regex, or explicit Global/Dynamic declaration.
Before you run
  • Add Assign Variable to the macro.
  • Prepare the data or target that Assign Variable will use.

Example workflow

Example: save copied content into a variable

  1. Copy Text some content on screen.
  2. Assign Variable result, source Clipboard.
  3. Use {result} in a later step.
Expected result: After execution, Assign Variable completes the described action and makes its result available to the next step.

Tips & limitations

To create a new variable with a type, use Declare Variable; Assign Variable updates a value.
  • Clipboard source depends on desktop/virtual context; a missing source variable can produce empty or unexpected output.

Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode & RunMacro Runner · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.