Using Scripting

You can use scripting to streamline repetitive tasks, integrate with external applications, and implement customized features.

From the Tools menu, choose Scripting and choose a command from the submenu.

IMPORTANT Scripts can pose a security risk to your computer. A script has the power to delete files, read files, write files, execute programs, access the Internet, access files on your network, and so on. Always examine the contents of a script before running it. If you don't understand the script, do not run it unless it comes from a trusted source. In general, take the same precautions you would take for any program you download from the Internet or receive in an e-mail attachment.

IMPORTANT

J# is not supported in .NET 4.0. If you need to use JScript scripts, please install the .NET 2.0/3.5 runtime libraries.

To install, choose Programs and Features, choose Turn Windows features on or off, and then select the .NET Framework 3.5 (includes .NET 2.0 and 3.0) check box.

After installing .NET, please restart VEGAS Pro.

Running a script

  1. From the Tools menu, choose Scripting.

  2. Choose a script from the submenu or choose Run Script from the submenu to browse to the script file (.vb or .cs) you want to run.

Adding scripts to the Scripting menu

When you start the program, VEGAS Pro looks at the Script Menu folder in the VEGAS Pro program folder to determine which scripts appear in the Scripting submenu. This folder is C:\Program Files\VEGAS\VEGAS Pro\21\Script Menu by default.

  1. Add or delete scripts in the Script Menu folder to change the contents of the submenu.

    TIP To prevent duplication of script files, you can use shortcuts in the Script Menu folder.

  2. From the Tools menu, choose Scripting, and then choose Rescan Script Menu Folder to update the menu.

Using VEGAS Pro extensions

VEGAS Pro extensions are compiled scripts that are available under the Extensions submenu in the View, Edit, or Tools menus. These extensions are loaded when VEGAS Pro starts and remain loaded as long as the program is running. Extensions can respond to changes in project data, control playback, and display a non modal interface.

You can use the Customize Toolbar dialog to add VEGAS Pro extensions to the toolbar, or use the Customize Keyboard dialog to assign keyboard shortcuts to VEGAS Pro extensions.

For more information, see Customizing the toolbar and Customizing keyboard shortcuts

VEGAS Pro extensions are saved in C:\Users\user name\AppData\Local\VEGAS\ Application Extensions.

Creating a script

VEGAS Pro scripting uses the Microsoft .NET framework for scripting. You can write scripts in C# or Visual Basic .NET.

Editing an existing script

All you need to edit a script is a simple text editor. The scripts that are included with VEGAS Pro are fully commented to help you find and edit the parameters you need.

  1. Create a copy of the script (.vb or .cs) file you want to edit, assigning a descriptive name to the copy.

  2. Open the new copy of the script in your text editor and edit the script as needed.

For more information, see VEGAS Pro Scripting FAQs

Creating custom button images for scripts

If you want to display custom icons for scripts in the Scripting menu and toolbars, you can add .png files to your Script Menu folder.

  1. Create a 32-bit PNG file with the icon you want to use. Icons must be 16x16 pixels, and transparency is supported.

  2. Save the PNG file in your Script Menu folder (typically C:\Program Files\VEGAS\VEGAS Pro 21.0\Script Menu) using the same name as the script the icon should represent.

    For example, to assign a custom icon to the HelloWorld.cs script, the icon should be saved as HelloWorld.cs.png.

  3. Customize the toolbar as needed, and the custom icons will be displayed in the Scripting menu (and in any toolbars that include the script) toolbar the next time you start the application.

Using VEGAS Pro command-line options

You can use the following commands to start VEGAS Pro from the command line, open projects, start scripts, pass arguments to scripts, or start VEGAS Pro extensions.

NOLOGO

Starts VEGAS Pro without displaying the application splash screen.

EXAMPLE Vegas210.exe /NOLOGO

OPEN

Starts VEGAS Pro and opens the specified media file or project.

EXAMPLE
Vegas210.exe /OPEN "E:\Video\Wildflowers 001.avi" 

—or—

Vegas210.exe /OPEN "E:\Vegas_Projects\24p widescreen.veg"

RUNSCRIPT

Starts VEGAS Pro and runs the specified script.

EXAMPLE
Vegas210.exe /RUNSCRIPT "C:\CustomScripts\ScriptName.cs" 

—or—

Vegas210.exe /SCRIPT "C:\CustomScripts\ScriptName.cs"

SCRIPTARGS

Starts VEGAS Pro and passes the specified arguments to a script.

EXAMPLE Vegas210.exe /SCRIPTARGS "<argument>" /SCRIPT "<script path>"

NOTE For more information about script arguments, please see the VEGAS Pro Scripting API.

CMDMODULE

Starts VEGAS Pro and loads the specified extension.

You can use this method to add VEGAS Pro extensions that are not saved in the extensions search path.

EXAMPLE Vegas210.exe /CMDMODULE "E:\Extensions\MyExtension.dll"

OPENPRJ

Starts VEGAS Pro and opens the project file referenced in the specified media file.

EXAMPLE Vegas210.exe /OPEN "E:\Video\Wildflowers 001.avi"

NOTE This command will have no effect if the specified media file was not rendered with an embedded project path reference.