# Embedding Rename Scripts

[Rename scripts](https://chaoses-ib.gitbook.io/directory-opus/manual/file_operations/renaming_files/advanced_rename/rename_scripts) can be embedded directly in a button or hotkey, which lets you rename files using a script without having to display the [**Advanced Rename**](https://chaoses-ib.gitbook.io/directory-opus/manual/file_operations/renaming_files/advanced_rename) dialog first.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-b478ffe94db0916aca8339245a7b51c0597ff310%2Frename_embed.png?alt=media)

This image depicts an example of an embedded rename script. The first line of such a button must call the [**Rename**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/command_reference/internal_commands/rename) command. This command actually invokes the Rename function - and you can use any of the arguments for the **Rename** command to perform "pre-processing" before the script is invoked. For example, you could use the command **Rename CASE=allwords** to capitalize words in the filename first, before the script is invoked. In the above screenshot the **Rename** command will not actually modify the filename itself - it will be passed through verbatim to the script.

Below the **Rename** command, the **@script** [command modifier](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/command_reference/command_modifier_reference) is used to introduce the script. This tells Opus which language the script is written in - **vbscript** is shown in the above screenshot, but you can specify **jscript** to use JavaScript, and other languages are also supported if you have them installed.

Any text in the function definition below the **@script** line defines the script itself. See the [Rename Scripts](https://chaoses-ib.gitbook.io/directory-opus/manual/scripting/rename_scripts) page for more information on writing rename scripts.
