ImportFile and OpenFile functions

vadimred13 wrote on 12/22/2008, 1:51 PM
I ran into an issue that I wanted to share, so that everyone is informed. According to the API, the OpenFile and ImportFile functions are supposed to import audio to the currently selected track. This is not, in fact, what happens.

Open up Vegas and create several audio or video tracks. Click on one of them. Notice how it becomes selected. Also notice the little blinking square to the left of the track number. Now, hold the Ctrl key and click on several other tracks to select them as well. Notice how the blinking square jumps to the last track that you clicked on. Now hold the Ctrl key again, but this time click on an already selected track to de-select it. The blinking square stays on the track that you just deselected.

What does this mean? Well, the track that currently has the blinking square is the "Active" track, and when you use the ImportFile or OpenFile functions, the Active track is the one that gets imported to. Keep in mind, that if you manually import a file through Vegas, it gets imported to the correct track - the selected one, but if you try to write a script or custom command that utilizes either of these two functions, then the media will be imported to the Active track.

How will this affect you? Well, it affected me when I tried to create a script to merge two mono audio tracks into one stereo and when I tried to write a custom command that will let me process audio events with Plug-ins on an existing bus. I ended up finding a workaround by creating my own ImportFile function that created a new event, new media, and a new take on the track that I wanted to import to.

I am using Vegas 8.0c and am running Windows XP SP2. I write my scripts and application extensions in C#. If anyone is NOT experiencing this issue, please let me know.

Cheers,
Vadim