Embedding Rename Scripts

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 dialog first.

rename embed.png

This image depicts an example of an embedded rename script. The first line of such a button must call the 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 modifiy the filename itself - it will be passed through verbatim to the script.

 

Below the Rename command, the @script command modifier 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 specifiy 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 page for more information on writing rename scripts.