Need a script which can move split cuts left or right on multiple evnt

iEmby wrote on 8/25/2024, 12:21 AM

@jetdv @zzzzzz9125 @Thiago_Sase

how can we do it.. for events which we need to decrease from ending is adjusting length which can be done but how can we change starting of any event without affecting length.

 

Last changed by iEmby

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

Comments

Jack S wrote on 8/25/2024, 6:06 AM

This works for me.

myEvent.ActiveTake.Offset = myEvent.ActiveTake.Offset + timecodeLeadingTrim;

That trims the leading edge. If you want to extend the event leading edge change the plus into a minus, although I haven't tried that. If you do that, you'd have to check that extending the leading edge doesn't take you past the start of the event, otherwise a loop point will be created.

 

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

iEmby wrote on 8/25/2024, 10:56 AM

This works for me.

myEvent.ActiveTake.Offset = myEvent.ActiveTake.Offset + timecodeLeadingTrim;

That trims the leading edge. If you want to extend the event leading edge change the plus into a minus, although I haven't tried that. If you do that, you'd have to check that extending the leading edge doesn't take you past the start of the event, otherwise a loop point will be created.

 

thankyou sir...

let me try it once.

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

Thiago_Sase wrote on 8/25/2024, 7:16 PM

@iEmby This Script will close the gaps by extending the length of fragmented clips from one selected event. It has 2 options;

Right to Left;
Left To Right.


using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using ScriptPortal.Vegas;

namespace ArrowButtonScripts
{
    public class Class1
    {
        public Vegas myVegas;

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

            // Create and show the form with buttons, centered on the screen
            Application.EnableVisualStyles();
            Application.Run(new ArrowButtonsForm(this));
        }

        // Method to close gaps by adjusting the start and length of events (left arrow)
        public void CloseGapsLeft()
        {
            var selectedEvents = new List<TrackEvent>();

            foreach (Track track in myVegas.Project.Tracks)
            {
                foreach (TrackEvent trackEvent in track.Events)
                {
                    if (trackEvent.Selected)
                    {
                        selectedEvents.Add(trackEvent);
                    }
                }
            }

            bool gapsClosed;

            do
            {
                gapsClosed = true;

                for (int i = 1; i < selectedEvents.Count; i++)
                {
                    TrackEvent currentEvent = selectedEvents[i];
                    TrackEvent previousEvent = selectedEvents[i - 1];

                    Timecode gap = currentEvent.Start - previousEvent.End;

                    if (gap > Timecode.FromSeconds(0))
                    {
                        currentEvent.Start -= gap;
                        currentEvent.Length += gap;
                        currentEvent.ActiveTake.Offset -= gap;

                        gapsClosed = false;
                    }
                }
            } while (!gapsClosed);
        }

        // Method to close gaps by extending the length of the previous event (right arrow)
        public void CloseGapsRight()
        {
            Timecode zero = new Timecode("00:00:00:00");

            foreach (Track track in myVegas.Project.Tracks)
            {
                TrackEvent previousEvent = null;

                foreach (TrackEvent currentEvent in track.Events)
                {
                    if (currentEvent.Selected)
                    {
                        if (previousEvent != null)
                        {
                            Timecode gap = currentEvent.Start - previousEvent.End;

                            if (gap > zero)
                            {
                                previousEvent.Length += gap;
                            }
                        }

                        previousEvent = currentEvent;
                    }
                }
            }
        }
    }

    public class ArrowButtonsForm : Form
    {
        private Class1 scriptClass;

        public ArrowButtonsForm(Class1 scriptClass)
        {
            this.scriptClass = scriptClass;
            this.Text = "Close Gaps";
            this.Size = new System.Drawing.Size(207, 200);

            // Center the form on the screen
            this.StartPosition = FormStartPosition.CenterScreen;
            this.BackColor = Color.FromArgb(40, 40, 40); // Dark background color

            // Title font control
            Font titleFont = new Font("Segoe UI", 12, FontStyle.Bold); // Change font type and size here
            this.Font = titleFont;
            this.ForeColor = Color.White; // White text color

            // Arrow button font control
            Font arrowFont = new Font("Segoe UI", 20, FontStyle.Regular); // Change arrow font type and size here

            // Title Label
            Label titleLabel = new Label
            {
                Text = "Close Gaps by Extending the Length of Fragmented Clips from One Selected Event:",
                Location = new Point(10, 10),
                Size = new Size(180, 60), // Increased label size for full text visibility
                Font = new Font("Segoe UI", 10, FontStyle.Regular), // Control font type and size here
                ForeColor = Color.White,
                BackColor = Color.Transparent,
                AutoSize = false // Disable AutoSize to use the custom Size
            };
            Controls.Add(titleLabel);

            // Left Arrow Button (up position)
            Button btnCloseGapsLeft = new Button
            {
                Text = "←",
                Location = new System.Drawing.Point(10, 80), // Positioned as far left as possible
                Size = new System.Drawing.Size(80, 60), // Larger size
                BackColor = Color.FromArgb(60, 60, 60), // Dark button color
                ForeColor = Color.White,
                FlatStyle = FlatStyle.Flat,
                FlatAppearance = { BorderColor = Color.FromArgb(100, 100, 100) },
                Font = arrowFont
            };
            btnCloseGapsLeft.Click += (sender, e) => { scriptClass.CloseGapsLeft(); this.Close(); };
            Controls.Add(btnCloseGapsLeft);

            // Right Arrow Button (below the left one)
            Button btnCloseGapsRight = new Button
            {
                Text = "→",
                Location = new System.Drawing.Point(100, 80), // Positioned as far left as possible
                Size = new System.Drawing.Size(80, 60), // Larger size
                BackColor = Color.FromArgb(60, 60, 60), // Dark button color
                ForeColor = Color.White,
                FlatStyle = FlatStyle.Flat,
                FlatAppearance = { BorderColor = Color.FromArgb(100, 100, 100) },
                Font = arrowFont
            };
            btnCloseGapsRight.Click += (sender, e) => { scriptClass.CloseGapsRight(); this.Close(); };
            Controls.Add(btnCloseGapsRight);

            // Set focus to the form itself, so no button is focused by default
            this.Shown += (sender, e) => this.ActiveControl = null;
        }
    }

    public class EntryPoint
    {
        public void FromVegas(Vegas vegas)
        {
            ArrowButtonScripts.Class1 scriptInstance = new ArrowButtonScripts.Class1();
            scriptInstance.Main(vegas);
        }
    }
}

That was a hard level for me to do, but I got it. I'm trying to understand better, after each script made, how C# language works.

@jetdv tutorials are helping a lot.

Maybe this Script does not do exactly what you want, but can be a very nice Reference.

jetdv wrote on 8/25/2024, 7:25 PM