Variables
If you have text that you would like to reuse across multiple rules, then you can assign the text to a variable and reference it in the Name, Value, and Site fields. The variables defined here can also be used in text clips. Each line needs to follow this syntax:
variable_name = some text
Variable names can only contain letters, numbers, and the underscore character. The text cannot contain line breaks; if you want to output a line break, then use \n instead. You can even set a variable to a value returned by JavaScript by prefixing the code with javascript: (🎞️ watch tutorial). Unlike JavaScript rules, JavaScript variables do NOT have access to the DOM. Any line starting with “#” is treated as a comment and will not be evaluated. Here are some examples to get you started (more in variables.txt):
# Short date (e.g., "1/17/2022" -- format is region-specific)
short_date = javascript:new Date().toLocaleDateString()
# Random alphanumeric (e.g., "e5yk80p9x57")
rand_alphanumeric = javascript:Math.random().toString(36).slice(2)To use a variable in a rule, enter {@variable_name} (e.g., {@short_date}). Lightning Autofill supports many other types of variable expansion.
💎 PRO
JavaScript variables are only available to Pro subscribers.