# runScript

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

Take a look at our [JavaScript docs](https://docs.moropo.com/creating-tests/advanced-use-cases/javascript) 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}
```
