Can scripts be initiated from the command line (or some other program)? If so, can parameters be passed to the script? Can Vegas be run as a windows service?
1) you can start vegas from the command line like so:
vegas40.exe -SCRIPT:<full-path-to-script-file>
You can also send a running instance of Vegas messages that instruct
it to run a script.
2) Parameters cannot be passed to a script in the same way you might
pass parameters to a command-line app but you can work around it by
sticking parameters in a known location, such as the script's
configuration XML file or the registry.
3) Vegas itself does not have a run-as-service mode but you could
possibly write a service that manages Vegas and sends it script
messages.
I get the following error when trying to initiate the script:
"An invalid argument was specified"
I am running Vegas4.0 (build 115)
command issued:
cd <dir containing exe>
vegas40.exe -SCRIPT:c:\test3.js
I also tried putting the script in the same directory as the .exe but got the same results. I verified the script runs properly by invokeing it via the GUI.
I downloaded 4.0b. It allows me to run a script from the command line. However, every time I run a script I get another instance of the GUI. Is there a way in the script to close the GUI?
I've created a script that separates the left and right audio channels from an audio track and then creates a file for each channel. When the script is run from the GUI it works (sort of - the second channel is not rendered properly - no audio). However, when I run the same script from the command line it does not render the files correctly. The GUI indicates it is rendering the track. The files are created and are the corrct length but there is no audio.
In addition to writing a script that separates two channels into two distinct files, I am trying to write a script that does just the opposite, taking two distinct files and rendering them as one. From the GUI I am able to accomplish this. However, from a script I cannot find out how to pan 100% L on one file (track)and 100% R on the other. Currently my result is two channels in one file (track) but both channels are the same. Is it possible to accomplish this feature using scripting?
Have you tried adding Pan envelopes to your audio tracks?
var pan1 = new Envelope(EnvelopeType.Pan);
audioTrack1.Envelopes.Add(pan1);
var pan2 = new Envelope(EnvelopeType.Pan);
audioTrack2.Envelopes.Add(pan2);
pan1.Points[0].Y = 1; // pan 100% right
pan2.Points[0].Y = -1; // pan 100% left
With the new 4.0c version when I call the Vegas.Exit() method, a message box appears asking if I want to save. The project was created with Vegas.NewProject(false,false). Since this script is being run from the command line by another porgram, no response is possible. Has the project been created wrong or is this feature not available?
Before you call Vegas.Quit(), call Vegas.SaveProject(fileName)... taht way the "Do you want to save" dialog will not appear since the project has no pending modifications.
I tried the SaveProject() and SaveProject(filename). It still pops up a message box asking if the project should be saved (it does contain the name of the filename entered in the SaveProject() method).
I tried the workaround with slight modifications (filename in SaveProject() to prevent asking of filename to save and Vegas.Exit() instead of Vegas.Quit())
The following message appears:
A background operation is currently in progress.
Vegas cannot shutdown until this operation is complete or cancelled.
Would you like to cancel this operation?
The only changes to the script were the recommend 3 lines. Without the 3 lines the script works correctly except for a message box asking to save files. The script exits properly when the message box is responded to.
True, the basic idea is to send Vegas a WM_COPYDATA message but there
are more details involved (finding Vegas's hwnd, the contents of the
COPYDATASTRUCT, etc.). To illustrate these details, I have posted a
sample C# application that remotely controls Vegas.
Thank very much. Suggestion: maybe it would also be handy to send the whole script in the WM_COPYDATA message instead of the script path, thus the script file does not need to exist at all...
I finnally got my script to work from the command line. The script takes a .wmv file and splits the left and right audio channels into separate .wav files. However, when I try and run the script with slight modifications to work with .mpg files it doesn't work. It creates a left and a right .mpa file. The mpa file plays fine in Vegas. However, no other player can play the mpa file.