render Over Visual Basic

taurojo wrote on 7/6/2017, 7:19 AM

Hi!

I got to launch this simple Script created in Visual Studio 2017.

I'ts a compilated dll over .NET 4.

All ok in the render. But i don not posibilitti to pres CANCEL buton in render status. I can not press the CANCEL button in the render state and stop the render.

Over Sony Vegas 14.

 

Thanks a lot.

Srry for my english!

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

namespace WindowsFormsApp6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {


          
            
            string nombreExportado = "test";
            string mastertemplatedefecto = "Video for Windows";
            string templatedefecto = "Aquarium Video";
            string rutaPath = @"C:\Users\adelpino\Documents\Zeta Resource Editor projects\";

            
            Timecode selectionLength;
            Timecode selectionStart;


            Renderer renderer = EntryPoint.myVegas.Renderers.FindByName(mastertemplatedefecto);

            if (renderer != null)
            {
                RenderTemplate renderTemplate = renderer.Templates.FindByName(templatedefecto); 
                if (renderTemplate != null)
                {
                    // Si no existe selección cojemos todo el timeline.
                    if (EntryPoint.myVegas.SelectionLength.FrameCount > 0)
                    {
                        selectionStart = EntryPoint.myVegas.SelectionStart;
                        selectionLength = EntryPoint.myVegas.SelectionLength;
                    }
                    else
                    {
                        selectionStart = new Timecode();
                        selectionLength = EntryPoint.myVegas.Project.Length;
                    }


                    /// PUNTO DE RENDERIZADO
                    EntryPoint.myVegas.Render(rutaPath + nombreExportado + ".avi", renderTemplate, selectionStart, selectionLength);
                }

            }
        }




        public class EntryPoint
        {
           
            public static Vegas myVegas;

            public void FromVegas(Vegas vegas)
            {
                myVegas = vegas;

                try
                {
                    
                    Form1 form1 = new Form1();
                    form1.ShowDialog();
                }
                catch (Exception e)
                {

                    MessageBox.Show(e.Message);
                }
            }
        }



    }
}