DocsCodeConvert 2FA

Generate a 2FA OTP code from a secret in RunMacro

Desktop ModeBrowser ModeRunMacro RunnerRunMacro 3.5+

The Convert 2FA command generates a two-factor OTP code (like Google Authenticator) from a 2FA secret key.

Dialog & quick setup

RunMacro Convert 2FA command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Convert 2FA command in RunMacro.
  1. Add a Code › Convert 2FA command.
  2. Choose the secret source: from the clipboard or typed (secret key).
  3. Choose the output: virtual clipboard / variable / real clipboard.
  4. Use Paste from Clipboard or the variable to fill the code. Save.

Options reference

Secret source (Clipboard / manual)

Take the 2FA secret from the clipboard, or enter the secret key directly.

Secret key

The 2FA secret string (base32). RunMacro strips spaces/dashes and uppercases it.

Output mode

Virtual clipboard, a variable (default otp), the real clipboard, or both virtual clipboard + variable.

Modes & when to use

Desktop Mode
Browser Mode

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

RunMacro Runner

Best for

  • Auto-fill a 2FA code at account login.
  • Process many accounts with 2FA enabled.
  • Generate OTP from a secret stored in a Sheet/file.

Use an alternative when

  • Do not use an untrusted 2FA seed or when the system clock is not synchronized.
Before you run
  • Add Convert 2FA to the macro.
  • Prepare the data or target that Convert 2FA will use.

Example workflow

Example: fill a 2FA code at login

  1. Set Clipboard = the account 2FA secret (or from a Sheet).
  2. Convert 2FA, source Clipboard, output to variable otp.
  3. Click the code field, Type Text {otp}.
Expected result: After execution, Convert 2FA completes the described action and makes its result available to the next step.

Tips & limitations

The pyotp library must be installed for code generation (it warns if missing).
The OTP changes about every 30 seconds — generate and use it right away to avoid expiry.
  • TOTP depends on secret and time; clock drift or a wrong seed produces invalid codes, and the secret is sensitive.

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.