Render Audio Tracks Seperately

Randini wrote on 11/7/2014, 12:59 PM
I have a 50 a track audio project where each track various in time. I tried tools/scripting/render audio tracks while selecting Render loop region only. The render files then have the length of the longest render loop. This is not good for this leaves many of the audio files with blank space at the end. When I uncheck Render Loop it just picks the longest length for all files.

Please is there a way to render these in separate tracks with their original length?

Thank you,
Randini

Comments

rs170a wrote on 11/7/2014, 1:13 PM
The app you want is called Trackalizer and it's a free download from the good folks at VASST. I've used it several times and it works like a charm :)

Mike
Arthur.S wrote on 11/7/2014, 1:17 PM
Wouldn't just turning off (muting) the tracks you don't want work?
rs170a wrote on 11/7/2014, 1:19 PM
Arthur, you can do it that way but Trackalizer is SO much easier. Run it and every audio track is exported separately. You have other render choices in there too.

Mike
altarvic wrote on 11/7/2014, 1:28 PM
standard script Render Audio Tracks should work exactly as you need
Randini wrote on 11/7/2014, 3:01 PM
I downloaded the Vaast script and it does the exact same problem as the script I mentioned in Vegas. I don't think anyone is understanding my problem. EXAMPLE:

Track 1 is 3:35
Track 2 is 1:00

When the script renders it makes track 2 to the same length as track 1

Is it possible to have Vegas recognize the last audio media in a track and end the render there?
johnmeyer wrote on 11/7/2014, 5:46 PM
I understand exactly what you want. I modified the default "Render Audio Tracks.cs" script that ships with Vegas so that the length of the audio file rendered for each track equals the length of the audio on that track. If the audio doesn't start at timecode 0, it will start the render wherever the first event on that track starts. Thus, there will be no silence at either the beginning or the end of the rendered files.

Copy this script to Notepad, and then save it with the extension ".cs". Make sure to NOT copy "code block."

/**
* This script renders each audio track individually.
*
* Revision Date: March 26, 2010.
* Modified Date: November 7, 2014 by John H. Meyer
* Modifications create audio length equal to the length of all audio on each individual track
**/

using System;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

String OutputDir;
Renderer SelectedRenderer;
RenderTemplate SelectedTemplate;
bool CanUseSelection = false;
bool UseSelection = true;
bool foundfirst = true;

string[] SupportedExtensions = {"*.wav", "*.aif", "*.flac", "*.mp3", "*.ogg", "*.pca", "*.w64"};

TextBox OutputDirBox = new TextBox();
Button BrowseButton = new Button();
ComboBox RendererCombo = new ComboBox();
ComboBox TemplateCombo = new ComboBox();
CheckBox UseSelectionBox = new CheckBox();
Button okButton = new Button();

int ProjectChannelCount = 0;

public void FromVegas(Vegas vegas)
{
myVegas = vegas;
if (AudioBusMode.Surround == myVegas.Project.Audio.MasterBusMode)
{
ProjectChannelCount = 6;
}
else if (AudioBusMode.Stereo == myVegas.Project.Audio.MasterBusMode)
{
ProjectChannelCount = 2;
}

CanUseSelection = (1 < myVegas.Transport.LoopRegionLength.Nanos);

if (DialogResult.OK != DoDialog())
{
return;
}

RenderArgs args = new RenderArgs();
if (null == SelectedTemplate)
{
throw new ApplicationException("render template not selected.");
}

args.RenderTemplate = SelectedTemplate;
args.UseSelection = CanUseSelection && UseSelection;
foreach (Track track in myVegas.Project.Tracks)
{
if (track.IsAudio())
{
foundfirst = true;
AudioTrack audioTrack = (AudioTrack) track;
String trackName = String.Format("track {0:D2}", audioTrack.DisplayIndex);
if (!String.IsNullOrEmpty(audioTrack.Name))
{
trackName = String.Format("{0} ({1})", trackName, track.Name);
}
trackName += args.RenderTemplate.FileExtensions[0].Substring(1);
args.OutputFile = Path.Combine(OutputDir, trackName);
audioTrack.Solo = true;

// John Meyer Modifications
foreach(TrackEvent evnt in track.Events) {
if (foundfirst) {
foundfirst = false;
myVegas.SelectionStart = evnt.Start;
myVegas.SelectionLength = new Timecode(0);
}
myVegas.SelectionLength = myVegas.SelectionLength + evnt.Length;
}
// End John Meyer Modifications

myVegas.Render(args);
audioTrack.Solo = false;
}
}
}


DialogResult DoDialog()
{
Form form = new Form();
form.SuspendLayout();
form.AutoScaleMode = AutoScaleMode.Font;
form.AutoScaleDimensions = new SizeF(6F, 13F);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterParent;
form.MaximizeBox = false;
form.MinimizeBox = false;
form.HelpButton = false;
form.ShowInTaskbar = false;
form.Text = "Render Audio Tracks";
form.AutoSize = true;
form.AutoSizeMode = AutoSizeMode.GrowAndShrink;

TableLayoutPanel layout = new TableLayoutPanel();
layout.AutoSize = true;
layout.AutoSizeMode = AutoSizeMode.GrowAndShrink;
layout.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
layout.ColumnCount = 3;
layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 140));
layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 180));
layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 80));
form.Controls.Add(layout);

Label label;

label = new Label();
label.Text = "Output Folder:";
label.AutoSize = false;
label.TextAlign = ContentAlignment.MiddleLeft;
label.Margin = new Padding(8, 8, 8, 4);
label.Anchor = AnchorStyles.Left|AnchorStyles.Right;
layout.Controls.Add(label);
layout.SetColumnSpan(label, 3);

if (!String.IsNullOrEmpty(myVegas.Project.FilePath))
{
OutputDirBox.Text = Path.GetDirectoryName(myVegas.Project.FilePath);
}
else
{
OutputDirBox.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
}
OutputDirBox.Anchor = AnchorStyles.Left|AnchorStyles.Right;
OutputDirBox.Margin = new Padding(16, 8, 8, 4);
layout.Controls.Add(OutputDirBox);
layout.SetColumnSpan(OutputDirBox, 2);

BrowseButton.FlatStyle = FlatStyle.System;
BrowseButton.Text = "Browse";
BrowseButton.AutoSize = true;
layout.Controls.Add(BrowseButton);


label = new Label();
label.Text = "Save as type:";
label.AutoSize = false;
label.TextAlign = ContentAlignment.MiddleLeft;
label.Margin = new Padding(8, 8, 8, 4);
label.Anchor = AnchorStyles.Left|AnchorStyles.Right;
layout.Controls.Add(label);

RendererCombo.Anchor = AnchorStyles.Left|AnchorStyles.Right;
layout.Controls.Add(RendererCombo);
layout.SetColumnSpan(RendererCombo, 2);

label = new Label();
label.Text = "Template:";
label.AutoSize = false;
label.TextAlign = ContentAlignment.MiddleLeft;
label.Margin = new Padding(8, 8, 8, 4);
label.Anchor = AnchorStyles.Left|AnchorStyles.Right;
layout.Controls.Add(label);

TemplateCombo.Anchor = AnchorStyles.Left|AnchorStyles.Right;
layout.Controls.Add(TemplateCombo);
layout.SetColumnSpan(TemplateCombo, 2);

UseSelectionBox.Text = "Render loop region only";
UseSelectionBox.Checked = CanUseSelection && UseSelection;
UseSelectionBox.Enabled = CanUseSelection;
UseSelectionBox.AutoSize = false;
UseSelectionBox.FlatStyle = FlatStyle.System;
UseSelectionBox.Margin = new Padding(16, 8, 8, 4);
UseSelectionBox.Anchor = AnchorStyles.Left|AnchorStyles.Right;
layout.Controls.Add(UseSelectionBox);
layout.SetColumnSpan(UseSelectionBox, 3);

FlowLayoutPanel buttonPanel = new FlowLayoutPanel();
buttonPanel.FlowDirection = FlowDirection.RightToLeft;
buttonPanel.Size = Size.Empty;
buttonPanel.AutoSize = true;
buttonPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
buttonPanel.Margin = new Padding(8, 8, 8, 8);
buttonPanel.Anchor = AnchorStyles.Top|AnchorStyles.Right;
layout.Controls.Add(buttonPanel);
layout.SetColumnSpan(buttonPanel, 3);

Button cancelButton = new Button();
cancelButton.Text = "Cancel";
cancelButton.FlatStyle = FlatStyle.System;
cancelButton.DialogResult = DialogResult.Cancel;
buttonPanel.Controls.Add(cancelButton);
form.CancelButton = cancelButton;

okButton.Text = "OK";
okButton.FlatStyle = FlatStyle.System;
okButton.DialogResult = DialogResult.OK;
buttonPanel.Controls.Add(okButton);
form.AcceptButton = okButton;

BrowseButton.Click += HandleBrowseOutputDir;
FillRenderers(RendererCombo);
RendererCombo.SelectedValueChanged += HandleRendererChanged;
if (0 < RendererCombo.Items.Count)
{
RendererCombo.SelectedIndex = 0;
}
form.ResumeLayout();


DialogResult result = form.ShowDialog(myVegas.MainWindow);
if (DialogResult.OK == result)
{
OutputDir = OutputDirBox.Text;
SelectedTemplate = TemplateCombo.SelectedItem as RenderTemplate;
if (CanUseSelection) UseSelection = UseSelectionBox.Checked;
}
return result;
}

void HandleBrowseOutputDir(Object sender, EventArgs args)
{
string newDir = null;
myVegas.FileUtilities.SelectDirectoryDlg(myVegas.MainWindow.Handle, "Output Folder", OutputDirBox.Text, true, out newDir);
if (!String.IsNullOrEmpty(newDir))
{
OutputDirBox.Text = newDir;
}
}

void FillRenderers(ComboBox box)
{
foreach (Renderer renderer in myVegas.Renderers)
{
if (ShouldAddRenderer(renderer))
{
box.Items.Add(renderer);
}
}
}

bool ShouldAddRenderer(Renderer renderer)
{
if (renderer.Name.Contains("Scott"))
{
return false;
}
foreach (string ext in renderer.FileExtensions)
{
if (ShouldAddExtension(ext))
{
return true;
}
}
return false;
}

bool ShouldAddExtension(string ext)
{
foreach (string supportedExt in SupportedExtensions)
{
if (ext == supportedExt)
{
return true;
}
}
return false;
}

void HandleRendererChanged(Object sender, EventArgs args)
{
Renderer renderer = RendererCombo.SelectedItem as Renderer;
if (null == renderer) return;
TemplateCombo.Items.Clear();
foreach (RenderTemplate plate in renderer.Templates)
{
if (ProjectChannelCount < plate.AudioChannelCount)
{
continue;
}
TemplateCombo.Items.Add(plate);
}
if (0 < TemplateCombo.Items.Count)
{
TemplateCombo.SelectedIndex = 0;
okButton.Enabled = true;
}
else
{
okButton.Enabled = false;
}
}

}
Randini wrote on 11/7/2014, 6:31 PM
Hello John,

It works!!! I had to select LOOP REGION.
How do I make this code be a permanent part of the tools/script?

Thank you so very much!

Cheers!
johnmeyer wrote on 11/7/2014, 7:17 PM
Oh yeah, you are right. I completely overlooked the fact that the script won't get to my code unless you already have a loop region selected. I could change that by changing one line, but since you figured it out, I guess you can just live with this flaw.

I don't have V13 on this computer, so I don't know the exact steps for making this script directly accessible (they changed a little in the newer versions of Vegas), but in V10 you go to the Options menu and then select either the Cutomize Toolbar or Customize Keyboard options. This lets you put this script either on the icon toolbar or assign it to a keyboard shortcut. Sony degraded this ability by only allowing some things to be assigned to the toolbar, with the other things now having to go onto the playback toolbar. Grumble, grumble ...

If you put the script into this folder:

C:\Program Files\Sony\Vegas Pro 13.0\Script Menu

it will show up directly in the Script menu.

In earlier versions of Vegas you could actually change that script folder to a much friendlier location that didn't require you to muck about in the Program File area, but Sony removed the ability (via a hidden preference) to do this in Vegas 10, never to return. At least they brought back the ability to open a Veg file by dragging it to the Vegas title bar. That was removed for at least three iterations.

Grumble, grumble ...


Rob Franks wrote on 11/8/2014, 3:10 AM
"Is it possible to have Vegas recognize the last audio media in a track and end the render there?"
Maybe you don't understand the concept of the TIMEline?

Your tracks are set up relative to others on a time line so that they play at specific times. Those times are relative to the positions each track holds. If you have an audio track set up to start at the 3 minute mark then clearly you will have 3 minutes of dead space in front of that track. That occurs so that it stays relevant to the timings on the other tracks. Given the fact that this is indeed the primary job of the TIMEline, there is no easy way to skirt it.

You could reposition all your audio tracks into a better pattern and the render. Just don't save the project that way. Once you're just close and recall the original project.

Or you could render one track at a time (use loop region and mute the other tracks).
johnmeyer wrote on 11/8/2014, 3:32 PM
Maybe you don't understand the concept of the TIMEline?At the risk of being slightly impolite, perhaps you don't understand that my script does exactly what the OP requested. His problem has been solved.

Randini wrote on 11/9/2014, 1:17 PM
Rob, the problem was solved by Johnmeyer's AWESOME script. This saves me so much time for I'm editing all the chapters in the bible. Each project is by book.

Cheers,
Randini
MisterRider wrote on 1/27/2015, 11:13 AM
Hi guys,

I have used the TRACKALIZER in past projects (best name ever,,,) - however, it does not work in Vegas Pro 13. Is there a new version? Is there a modification I need to do? Any help appreciated...

T
altarvic wrote on 1/27/2015, 12:52 PM
Is Render Audio Tracks script (under Tools > Scripting) the same as Trackalizer ?
qy70guy wrote on 1/29/2015, 11:28 AM
This script worked great for me....Just wanted to say thanks John.....
di-P wrote on 9/15/2023, 4:00 AM

Thank you this script works well. I had to make some little changes to make it work in Vegas Pro 14.0. (The length of the audio tracks was added gradually, I commented a line and it works). Here is the script:

 

/**Version for Vegas Pro 14.0
 * This script renders each audio track individually.
 *
 * Revision Date: March 26, 2010.
 **/

using System;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
using ScriptPortal.Vegas;

public class EntryPoint
{
    Vegas myVegas;
    
    String OutputDir;
    Renderer SelectedRenderer;
    RenderTemplate SelectedTemplate;
    bool CanUseSelection = false;
    bool UseSelection = true;
    bool foundfirst = true;

    string[] SupportedExtensions = {"*.wav", "*.aif", "*.flac", "*.mp3", "*.ogg", "*.pca", "*.w64"};

    TextBox OutputDirBox = new TextBox();
    Button BrowseButton = new Button();
    ComboBox RendererCombo = new ComboBox();
    ComboBox TemplateCombo = new ComboBox();
    CheckBox UseSelectionBox = new CheckBox();
    Button okButton = new Button();
    
    int ProjectChannelCount = 0;
    
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;
        if (AudioBusMode.Surround == myVegas.Project.Audio.MasterBusMode)
        {
            ProjectChannelCount = 6;
        }
        else if (AudioBusMode.Stereo == myVegas.Project.Audio.MasterBusMode)
        {
            ProjectChannelCount = 2;
        }

        CanUseSelection = (1 < myVegas.Transport.LoopRegionLength.Nanos);
        
        if (DialogResult.OK != DoDialog())
        {
            return;
        }
        
        RenderArgs args = new RenderArgs();
        if (null == SelectedTemplate)
        {
            throw new ApplicationException("render template not selected.");
        }

        args.RenderTemplate = SelectedTemplate;
        args.UseSelection = CanUseSelection && UseSelection;
        foreach (Track track in myVegas.Project.Tracks)
        {
            if (track.IsAudio())
            {
                AudioTrack audioTrack = (AudioTrack) track;
                String trackName = String.Format("track {0:D2}", audioTrack.DisplayIndex);
                if (!String.IsNullOrEmpty(audioTrack.Name))
                {
                    trackName = String.Format("{0} ({1})", trackName, track.Name);
                }
                trackName += args.RenderTemplate.FileExtensions[0].Substring(1);
                args.OutputFile = Path.Combine(OutputDir, trackName);
                audioTrack.Solo = true;


// John Meyer Modifications

                foreach(TrackEvent evnt in track.Events) {

                  if (foundfirst) {

                    foundfirst = false;

                    myVegas.SelectionStart = evnt.Start;

                    myVegas.SelectionLength = new Timecode(0);

                  }

 //                 myVegas.SelectionLength = myVegas.SelectionLength + evnt.Length;   

               myVegas.SelectionLength =  evnt.Length;

                }

// End John Meyer Modifications

                myVegas.Render(args);
                audioTrack.Solo = false;
            }
        }
    }


    DialogResult DoDialog()
    {
        Form form = new Form();
        form.SuspendLayout();
        form.AutoScaleMode = AutoScaleMode.Font;
        form.AutoScaleDimensions = new SizeF(6F, 13F);
        form.FormBorderStyle = FormBorderStyle.FixedDialog;
        form.StartPosition = FormStartPosition.CenterParent;
        form.MaximizeBox = false;
        form.MinimizeBox = false;
        form.HelpButton = false;
        form.ShowInTaskbar = false;
        form.Text = "Render Audio Tracks";
        form.AutoSize = true;
        form.AutoSizeMode = AutoSizeMode.GrowAndShrink;

        TableLayoutPanel layout = new TableLayoutPanel();
        layout.AutoSize = true;
        layout.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        layout.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
        layout.ColumnCount  = 3;
        layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 140));
        layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 180));
        layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 80));
        form.Controls.Add(layout);

        Label label;

        label = new Label();
        label.Text = "Output Folder:";
        label.AutoSize = false;
        label.TextAlign = ContentAlignment.MiddleLeft;
        label.Margin = new Padding(8, 8, 8, 4);
        label.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        layout.Controls.Add(label);
        layout.SetColumnSpan(label, 3);
        
        if (!String.IsNullOrEmpty(myVegas.Project.FilePath))
        {
            OutputDirBox.Text = Path.GetDirectoryName(myVegas.Project.FilePath);
        }
        else
        {
            OutputDirBox.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        }
        OutputDirBox.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        OutputDirBox.Margin = new Padding(16, 8, 8, 4);
        layout.Controls.Add(OutputDirBox);
        layout.SetColumnSpan(OutputDirBox, 2);

        BrowseButton.FlatStyle = FlatStyle.System;
        BrowseButton.Text = "Browse";
        BrowseButton.AutoSize = true;
        layout.Controls.Add(BrowseButton);


        label = new Label();
        label.Text = "Save as type:";
        label.AutoSize = false;
        label.TextAlign = ContentAlignment.MiddleLeft;
        label.Margin = new Padding(8, 8, 8, 4);
        label.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        layout.Controls.Add(label);

        RendererCombo.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        layout.Controls.Add(RendererCombo);
        layout.SetColumnSpan(RendererCombo, 2);

        label = new Label();
        label.Text = "Template:";
        label.AutoSize = false;
        label.TextAlign = ContentAlignment.MiddleLeft;
        label.Margin = new Padding(8, 8, 8, 4);
        label.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        layout.Controls.Add(label);

        TemplateCombo.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        layout.Controls.Add(TemplateCombo);
        layout.SetColumnSpan(TemplateCombo, 2);

        UseSelectionBox.Text = "Render loop region only";
        UseSelectionBox.Checked = CanUseSelection && UseSelection;
        UseSelectionBox.Enabled = CanUseSelection;
        UseSelectionBox.AutoSize = false;
        UseSelectionBox.FlatStyle = FlatStyle.System;
        UseSelectionBox.Margin = new Padding(16, 8, 8, 4);
        UseSelectionBox.Anchor = AnchorStyles.Left|AnchorStyles.Right;
        layout.Controls.Add(UseSelectionBox);
        layout.SetColumnSpan(UseSelectionBox, 3);
            
        FlowLayoutPanel buttonPanel = new FlowLayoutPanel();
        buttonPanel.FlowDirection = FlowDirection.RightToLeft;
        buttonPanel.Size = Size.Empty;
        buttonPanel.AutoSize = true;
        buttonPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
        buttonPanel.Margin = new Padding(8, 8, 8, 8);
        buttonPanel.Anchor = AnchorStyles.Top|AnchorStyles.Right;
        layout.Controls.Add(buttonPanel);
        layout.SetColumnSpan(buttonPanel, 3);
            
        Button cancelButton = new Button();
        cancelButton.Text = "Cancel";
        cancelButton.FlatStyle = FlatStyle.System;
        cancelButton.DialogResult = DialogResult.Cancel;
        buttonPanel.Controls.Add(cancelButton);
        form.CancelButton = cancelButton;

        okButton.Text = "OK";
        okButton.FlatStyle = FlatStyle.System;
        okButton.DialogResult = DialogResult.OK;
        buttonPanel.Controls.Add(okButton);
        form.AcceptButton = okButton;

        BrowseButton.Click += HandleBrowseOutputDir;
        FillRenderers(RendererCombo);
        RendererCombo.SelectedValueChanged += HandleRendererChanged;
        if (0 < RendererCombo.Items.Count)
        {
            RendererCombo.SelectedIndex = 0;
        }
        form.ResumeLayout();
        
        
        DialogResult result = form.ShowDialog(myVegas.MainWindow);
        if (DialogResult.OK == result)
        {
            OutputDir = OutputDirBox.Text;
            SelectedTemplate = TemplateCombo.SelectedItem as RenderTemplate;
            if (CanUseSelection) UseSelection = UseSelectionBox.Checked;
        }
        return result;
    }

    void HandleBrowseOutputDir(Object sender, EventArgs args)
    {
        string newDir = null;
        myVegas.FileUtilities.SelectDirectoryDlg(myVegas.MainWindow.Handle, "Output Folder", OutputDirBox.Text, true, out newDir);
        if (!String.IsNullOrEmpty(newDir))
        {
            OutputDirBox.Text = newDir;
        }
    }
    
    void FillRenderers(ComboBox box)
    {
        foreach (Renderer renderer in myVegas.Renderers)
        {
            if (ShouldAddRenderer(renderer))
            {
                box.Items.Add(renderer);
            }
        }
    }

    bool ShouldAddRenderer(Renderer renderer)
    {
        if (renderer.Name.Contains("Scott"))
        {
            return false;
        }
        foreach (string ext in renderer.FileExtensions)
        {
            if (ShouldAddExtension(ext))
            {
                return true;
            }
        }
        return false;
    }

    bool ShouldAddExtension(string ext)
    {
        foreach (string supportedExt in SupportedExtensions)
        {
            if (ext == supportedExt)
            {
                return true;
            }
        }
        return false;
    }

    void HandleRendererChanged(Object sender, EventArgs args)
    {
        Renderer renderer = RendererCombo.SelectedItem as Renderer;
        if (null == renderer) return;
        TemplateCombo.Items.Clear();
        foreach (RenderTemplate plate in renderer.Templates)
        {
            if (ProjectChannelCount < plate.AudioChannelCount)
            {
                continue;
            }
            TemplateCombo.Items.Add(plate);
        }
        if (0 < TemplateCombo.Items.Count)
        {
            TemplateCombo.SelectedIndex = 0;
            okButton.Enabled = true;
        }
        else
        {
            okButton.Enabled = false;
        }
    }

}