> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-en/action-guides/variables/set-variable.md).

# Set variable

This action is used to create or change the value of a variable (data container) in the script. Additionally, this action allows you to create input fields directly in the main interface, enabling users to fill in information before starting to run the tool.

* Allow user input from the interface: You check this option to create empty fields on the main screen, allowing users to directly enter values into the script before clicking run.
* Input required: When this option is selected, the system will require users to fill in all data or select a file before allowing them to click the run button. If left empty, the tool will immediately report an error to avoid running incorrectly due to forgotten information.

<figure><img src="/files/4Gx7yAsm2yjQNqO3N283" alt=""><figcaption></figcaption></figure>

The system supports 4 types of input data (Input Type) on the interface, including:

#### 1. Text Input Type

Used when you want users to manually enter a string, text, or number from the keyboard.

* Real-world example: You name the variable `$textContent`. When the user enters the content `"hello world"` into the input field on the interface, the value of the variable `$textContent` at this point will be `"hello world"` (`$textContent = "hello world"`).

<figure><img src="/files/NAr5RU8wVuTheY3qbY3I" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/rMH9H8Wi723oLc4VwVQW" alt=""><figcaption></figcaption></figure>

#### 2. File Selection Type

Used when the script needs to process a specific file on the user's computer (such as an image file, data file, configuration file...). A folder button will appear on the UI for users to click and browse for the file.

* Real-world example: The user selects a file named `bruh.png` located on drive D. The value of the variable `$filePath` received will be the absolute path of that file: `"D:\materials\bruh.png"` (`$filePath = "D:\materials\bruh.png"`). You can immediately use this variable `$filePath` to pass into the File upload action in subsequent steps.

<figure><img src="/files/WhUE38pRZpF4Oh3j2yvS" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/75HFvZXYmavqnHusY2dU" alt=""><figcaption></figcaption></figure>

#### 3. Checkbox Type

Checkbox is a UI component that allows users to toggle a binary option (yes/no, on/off, agree/disagree).

* Characteristics: When checked, the variable will receive the value `True`. When unchecked, the variable will receive the value `False`.
* Real-world example: You create an item labeled *"Check to place an order"* associated with the variable `$checkBox`. If the user checks this box, the variable `$checkBox` will have the value `True` (`$checkBox = True`). You can use an If block to check: if `$checkBox = True`, then proceed with the payment steps.

<figure><img src="/files/oavGTQUYWvoYGYh9WSPo" alt=""><figcaption></figcaption></figure>

#### 4. Combo Box Type

Combo Box (similar to Dropdown) is a UI component that displays a list of available options, allowing users to select a single value at a time. This feature helps minimize the chances of misspelling or incorrect data formatting.

* Characteristics: Helps maintain consistent data when selecting fixed information such as Country, Industry, Product Type, Operational Status...
* Real-world example: You configure a list of several countries associated with the variable `$country`. When the user opens the script and selects `"United States"` from the dropdown list, the variable `$country` in Automate will immediately receive the value `"United States"` (`$country = "United States"`).

<figure><img src="/files/B7QhWuutCAfkpLdu289T" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/2CXNx6IhQbw7v5nSJ0Eq" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-en/action-guides/variables/set-variable.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
