# Creating a script manually

## Introduction

If you're experienced in creating scripts for your Patchworks process flows and know exactly how to achieve what's needed, you can jump straight in and create scripts from first principles.

{% hint style="info" %}
If you prefer to start with AI assistance, please see [Creating a script with AI](https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/creating-a-script-with-ai).
{% endhint %}

## Need to know

* The maximum memory size for a custom script is 512MB
* The maximum size of a custom script is 4GB

## Creating a new script

Follow the steps below:

**Step 1**\
Log in to the [Patchworks dashboard](https://app.wearepatchworks.com/scripts) and select `scripts` from the left-hand navigation bar.

**Step 2**\
Select the `create script` button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Frq05aPxsoslqqCxPeEwz%2Fcreate%20script%201.png?alt=media&#x26;token=427a948b-ec37-4ff8-bd53-28df13d7f183" alt=""><figcaption></figcaption></figure></div>

**Step 3**\
Add a unique `name` and a `description` and then choose your preferred coding language:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FttpoaCnSWE8bt5XTb43i%2Fadd%20new%20manual%20script%201.png?alt=media&#x26;token=9658c23d-cccc-4fa5-a9b3-a149b65f5623" alt=""><figcaption></figcaption></figure></div>

{% hint style="warning" %}
Script names must be unique - you can't add two scripts with the same name.
{% endhint %}

{% hint style="info" %}
The Patchworks AI panel is displayed below as soon as your coding language is selected in the previous step. Please see [Creating a script with AI](https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/creating-a-script-with-ai) for information about these options.
{% endhint %}

**Step 4**\
Click the `create` button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fh9TCWReOJ5H9WKOr8ZH4%2Fadd%20new%20manual%20script%202.png?alt=media&#x26;token=becf8cb3-5c8f-4daa-8080-3687bd2b0662" alt=""><figcaption></figcaption></figure></div>

The new script is saved, and you're now in edit mode:&#x20;

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F8P03oJRLn441Aj36DPHX%2Fcreate%20script%205.png?alt=media&#x26;token=a814db8c-e857-4b74-b498-ba8438f24a23" alt=""><figcaption></figcaption></figure></div>

From here, you can [add](#adding-your-code) and [test](https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/testing-scripts) your code.

## **Adding & editing script code**

Follow the steps below:

**Step 1**\
Move down to the `code` panel.

**Step 2**\
Add your script code (remember that you can use *IntelliSense* for easy code entry) - for example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F84aXCgIJJ2vtgunReG2v%2Fcreate%20script%205a.png?alt=media&#x26;token=a80cd14e-6121-4dde-92fe-ded6587e8398" alt=""><figcaption></figcaption></figure></div>

**Step 3**\
When you're ready to test the script, click the `save and deploy` button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FH6nPNE6rRh0ywPQJkGd8%2Fscripts%204.png?alt=media&#x26;token=103b1a24-4bb2-4a3c-bcd9-0d1d6470e9d9" alt="" width="563"><figcaption></figcaption></figure></div>

This saves and deploys the code so it's ready for [testing](https://doc.wearepatchworks.com/product-documentation/developer-hub/custom-scripting/creating-and-testing-custom-scripts/testing-scripts).
