# runScript

The `runScript` the command allows you to call a JavaScript file from within your flow.

Take a look at our [JavaScript docs](/creating-tests/advanced-use-cases/javascript.md) for guidance on how to use this feature.

## Examples

To run another flow configured in Moropo

```yaml
- runScript:
    file: javascript.js   # name of the javascript file in Moropo + .js
```

Use within your script

```yaml
- launchApp
...
- runScript:
    file: javascript.js
...
```

## Passing environment variables

```yaml
- runScript:
    file: javascript.js
    env:
      SOME_KEY: "my value"
```

## Outputs

The results of a runScript can returned and accessed later in a flow.&#x20;

Consider a javascript file which returns two unique strings of text

```
// javascript.js
output.result1 = 'foo'
output.result2 = 'bar'
```

These could then be accessed later in the flow

```
- runScript:
    file: javascript.js
- inputText: ${output.result1}
- tapOn:
    text: ${output.result2}
```


---

# Agent Instructions: 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:

```
GET https://docs.moropo.com/creating-tests/commands/runflow-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
