--- title: "Generate Your Script Using AI Assistant" slug: "generate-your-script-using-ai-assistant" updated: 2024-11-18T15:50:08Z published: 2024-11-18T15:50:08Z canonical: "docs.processmaker.com/generate-your-script-using-ai-assistant" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.processmaker.com/llms.txt > Use this file to discover all available pages before exploring further. # Generate Your Script Using AI Assistant > [!TIP] > [**Plan Availability:**](https://www.processmaker.com/products/pricing/) ![Enterprise](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/Enterprise.png) ProcessMaker's AI Assistant in Script Editor helps you create highly usable scripts faster than coding them yourself. Generate a Script without knowing how to code. Use almost any natural language to describe the Script's intended functionality. For example, describe a Script to perform the following functionality using the following text: `Create an array of all U.S. states, arranged in alphabetical order, where each state has an ID matching its position in the array.` There is no need to describe which programming language in which to generate this Script because you select that programming language when [creating the Script](/v1/docs/create-a-new-script) prior to describing its function. > [!NOTE] > Language Support > > This feature is available only when creating a Script in **JavaScript** or **PHP**. Watch the following product tour to learn how to use AI to assist you in script generation. [Embedded content](https://demos.processmaker.com/embed/clwtiaet900ezdeu15985h57w?embed_v=2) ## Generate a Script From Text **Permissions** Your user account or group membership must have the following permissions to generate a [Script](/summer-2024/A7mdugENW7gZw1jmnrOv/designer-advanced/what-is-a-script) using natural language: - Scripts: View Scripts - Scripts: Create Scripts - Scripts: Edit Scripts See the [Scripts](/v1/docs/permission-descriptions-for-users-and-groups#scripts) permissions or ask your Administrator for assistance. Follow these steps to generate a Script using a natural language description of its function: 1. While in Script Editor, expand the **AI Assistant** panel. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/959543b9-29aa-4c91-a5c1-8c822a7dc939.png) The AI Assistant features display. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/c22d4feb-12b3-433d-b814-99ab9ddd5385.png) AI Assistant for Scripts in Script Editor 2. Click the **Generate Script From Text** option. The **Generate Script From Text** panel displays. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/8c56f585-60c7-4c1b-9852-4e1ee5d69a89.png) Generate Script From text panel in Script Editor 3. In the **Description** setting, enter a natural language description of how the script is to function. One Script description may use no more than 1000 tokens. A token is a common sequence of characters found in text for a particular language. Generally, one token corresponds to approximately four (4) characters of common English-language text. This corresponds to approximately 100 tokens to about 75 words in English. To the right of the **Description** label displays how many tokens your description currently uses. If your description exceeds 1000 tokens, shorten the length of your description. 4. Optionally, click the **Give me inspiration!** link for examples. From the **Need Inspiration?** field, view English-language phrases how to describe specific functions to generate in the Script. Click a phrase or phrase template to copy it into your Clipboard, and then paste it into into the appropriate location in your description. 5. Click the **Generate** button. The **Before you continue** screen displays. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/084e8045-c4df-4040-931e-db4dda6288e6.png) Ensure the cursor is positioned where you intend to place the generated script 6. Position your cursor in the position within Script Editor to place the generated script. By default, the cursor positions at the beginning of Line 1. Click the **Confirm** button. AI Assistant processes the natural language prompt describing the script, and then Script Editor displays two panes: - **Current Script:** The **Current Script** pane displays the script prior to the AI-generated script. - **AI Generated Response:** The **AI Generated Response** pane displays the AI-generated script. Differences in code from the script in the **Current Script** pane display with the following code highlighting: - **Additional code:** Additional code displays with a green-colored highlight. - **Removed code:** Removed code displays with a red-colored highlight. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/ceb94471-339f-41e4-8c33-aa71008a18fa.png) Comparing the current script against the AI generated script 7. Click one of the following buttons from the **AI Generated Response** pane: - **Apply Changes:** Click the **Apply Changes** button to accept the AI-generated script. Script Editor displays the AI-generated script in its default view. - **Cancel:** Click the **Cancel** button to not accept the AI-generated script. Script Editor displays the current script in its default view. ## Clean a Script to Improve Its Code Clean a Script to improve its coding structure and efficiency. Your Script does not need to have been [generated by AI Assistant](/v1/docs/generate-your-script-using-ai-assistant) to clean it. **Permissions** Your user account or group membership must have the following permissions to clean a [Script](/summer-2024/A7mdugENW7gZw1jmnrOv/designer-advanced/what-is-a-script): - Scripts: View Scripts - Scripts: Create Scripts - Scripts: Edit Scripts See the [Scripts](/v1/docs/permission-descriptions-for-users-and-groups#scripts) permissions or ask your Administrator for assistance. Follow these steps to use AI Assistant to clean a Script: 1. [Edit a Script](/v1/docs/manage-scripts#edit-a-script) in which to clean. 2. Expand the **AI Assistant** panel. The AI Assistant features display. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/c22d4feb-12b3-433d-b814-99ab9ddd5385.png) Cornea AI assistant for Scripts in Script Editor 3. Click the **Clean** option. AI Assistant processes the currently displayed script, and then Script Editor displays two panes: - **Current Script:** The **Current Script** pane displays the script prior to recommended cleaning. - **AI Generated Response:** The **AI Generated Response** pane displays the AI-cleaned script. Differences in code from the script in the **Current Script** pane display with the following code highlighting: - **Additional code:** Additional code displays with a green-colored highlight. - **Removed code:** Removed code displays with a red-colored highlight. If Cornea AI recommends no cleaning changes, the following message displays: **Nothing to clean.**. 4. Click one of the following buttons from the **AI Generated Response** pane: - **Apply:** Click the **Apply** button to accept the AI-cleaned script. Script Editor displays the AI-cleaned script in its default view. - **Cancel:** Click the **Cancel** button to not accept the AI-cleaned script. Script Editor displays the current script in its default view. ## **Document a Script** Use ProcessMaker's AI Assistant to add comments into the Script to document its functionality. Your Script does not need to have been [generated by AI Assistant](/v1/docs/generate-your-script-using-ai-assistant) to document it. **Permissions** Your user account or group membership must have the following permissions to document a [Script](/summer-2024/A7mdugENW7gZw1jmnrOv/designer-advanced/what-is-a-script): - Scripts: View Scripts - Scripts: Create Scripts - Scripts: Edit Scripts See the [Scripts](/v1/docs/permission-descriptions-for-users-and-groups#scripts) permissions or ask your Administrator for assistance. Follow these steps to use AI Assistant to document a Script: 1. [Generate](/v1/docs/generate-your-script-using-ai-assistant#generate-a-script-using-a-natural-language-description-of-its-function) or [edit a Script](/v1/docs/manage-scripts#edit-a-script) to document. 2. Expand the **AI Assistant** panel. The AI Assistant features display. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/c22d4feb-12b3-433d-b814-99ab9ddd5385.png) Cornea AI assistant for Scripts in Script Editor 3. Click the **Document** option. AI Assistant processes the currently displayed script, and then Script Editor displays two panes: - **Current Script:** The **Current Script** pane displays the script prior to its documentation. - **AI Generated Response:** The **AI Generated Response** pane displays the AI-documented script. Additional lines of code that document functionality display with a green-colored highlight. 4. Click one of the following buttons from the **AI Generated Response** pane: - **Apply:** Click the **Apply** button to accept the AI-documented script. Script Editor displays the AI-documented script in its default view. - **Cancel:** Click the **Cancel** button to not accept the AI-documented script. Script Editor displays the current script in its default view. ## **Explain How a Script Functions** Use ProcessMaker's AI Assistant to explain how a Script functions. Provide a Script, and AI Assistant describes its functionality in simple natural language. Your Script does not need to have been [generated by AI Assistant](/v1/docs/generate-your-script-using-ai-assistant) to explain its functionality. **Permissions** Your user account or group membership must have the following permissions to explain a [Script](/summer-2024/A7mdugENW7gZw1jmnrOv/designer-advanced/what-is-a-script): - Scripts: View Scripts - Scripts: Create Scripts - Scripts: Edit Scripts See the [Scripts](/v1/docs/permission-descriptions-for-users-and-groups#scripts) permissions or ask your Administrator for assistance. Follow these steps to use AI Assistant to explain how a Script functions: 1. [Edit a Script](/v1/docs/manage-scripts#edit-a-script) in which to explain how it functions. 2. Expand the **AI Assistant** panel. The AI Assistant features display. ![](https://cdn.document360.io/2d311614-fcb7-4424-8b4c-d4d3091eebeb/Images/Documentation/c22d4feb-12b3-433d-b814-99ab9ddd5385.png) Cornea AI assistant for Scripts in Script Editor 3. Click the **Explain** option. AI Assistant processes the currently displayed script, and then Script Editor displays two panes: - **Current Script:** The **Current Script** pane displays the script to be described its function. - **AI Explanation:** The **AI Explanation** pane displays the following structure within the explanation for the displayed script: - **Summary:** The **Summary** section describes in overview the displayed script's function. - **Explanation:** The **Explanation** section describes a sequential order in runtime what the script does in natural language.