# Uploading programs to several TRIK robots from Sublime Text

This article discusses the possibility of simultaneous loading of programs on a group of robots using the external text editor Sublime Text. The article is a continuation of the next material

{% content-ref url="run-2d-from-sublime" %}
[run-2d-from-sublime](https://help.trikset.com/en/integrations/sublime/run-2d-from-sublime)
{% endcontent-ref %}

## Setting up

Download the [send\_files.cmd](https://gist.github.com/anastasiia-kornilova/e1344f658a91449cf16217ec03147a18) file for Windows and place it in the folder where TRIK Studio is installed.

{% hint style="warning" %}
The manual was tested on Sublime Text 3 (Build 3211). You can download Sublime Text from the [official website](https://www.sublimetext.com/).
{% endhint %}

Before starting the program for the first time, you should log in to the TRIK controller via WinSCP. Instructions on how to do this are available [here](https://help.trikset.com/en/studio/utilities/winscp). After that WinSCP will remember that it was allowed to establish a connection with this robot and will not require confirmation. This step must be repeated each time a new controller is connected.

1\. Start Sublime Text.

2\. Choose `Tools → Build System → New Build System`

![](https://2483351831-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-9YMGCK0ySSnTAiseS%2F-MVfRx3yM-JcUssZ_3Kj%2F-MVfS3rv8qAs7Cc4I_t1%2F45%201%20En%20Sublime%202.png?alt=media\&token=5c38d3ce-e70f-4ff3-837a-853047143858)

3\. A window with a text file will open. In it, you need to erase everything and insert the following code instead:

```javascript
{
"cmd": ["D:\\TRIKStudio\\send_filesl.cmd", “<path to scripts dir>”, "<file with ip addresses>"],
"selector": "source.js"
}
```

Where:

* `<path to scripts dir>` — the full path to the folder with the programs to be loaded onto the robots, &#x20;
* `<file with ip addresses>` — the name of the`.txt` file that contains the IP addresses of the robots to upload the files.
* There must be one IP address per line. The file must be in the same folder as the programs to be uploaded.

4\. Specify your path to the `send_files.cmd` file instead of the one specified in the code.

Exapmple:

```javascript
"cmd": ["C:\\TRIKStudio\\send_files.cmd", "C:\\Users\\Admin\\myfiles", "ip_addr.txt"]
```

![](https://2483351831-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-9YMGCK0ySSnTAiseS%2F-MVfRx3yM-JcUssZ_3Kj%2F-MVfS81j0T8bYw1aqbp9%2F45%202%20En%20Sublime%202.png?alt=media\&token=771202cb-5495-4498-82a9-16224299bfea)

5\. Save the file in the suggested directory `<system directory>\Sublime Text 3\Packages\User` under the name`TRIK_SEND.sublime-build`.

6\. Choose`Tools → Build System` and then in the list opened choose`TRIK_send`.

![](https://2483351831-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-9YMGCK0ySSnTAiseS%2F-MVfRx3yM-JcUssZ_3Kj%2F-MVfSBwCDvm-S1-RyPCk%2F45%203%20En%20Sublime%202.png?alt=media\&token=65cf205a-64e6-4818-8c6e-246c41ebcba2)

7\. To start sending programs to robots, just click `Tools → Build` or the corresponding key combination `Ctrl+B`. In order to return to [start the 2D model](https://help.trikset.com/en/integrations/sublime/run-2d-from-sublime), select `Tools → Build System` and select `TRIK` in the list that opens.

![](https://2483351831-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-9YMGCK0ySSnTAiseS%2F-MVfRx3yM-JcUssZ_3Kj%2F-MVfSG5XqHB9s1NHfAnE%2F45%204%20En%20Sublime%202.png?alt=media\&token=6e1c1a66-d990-43d0-9e1b-d3c95fc61d6b)
