Problem In My ProgressWorker code. Need Help!

iEmby wrote on 3/2/2024, 1:19 PM

@jetdv
can u help me with my progress worker code.

most of time it work good i add a prgressing gif file which keep showing while processing.

i add ShowProgressForm();

in code before process start and add CloseProgressForm(); when process finished

it working good most of cases.

but in some cases i dont know what happened but progress form not get close. even i added CloseProgressForm(); thrice.

i tried to change locations of both ProgressForms but problem still appeared.

 

*******************************************************************************************************************

this is the error

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ApplicationException: Unhandled exception on main thread. ---> System.ApplicationException: Unhandled exception on main thread. ---> System.InvalidOperationException: Value Close() cannot be called while doing CreateHandle().
   at System.Windows.Forms.Form.Close()
   at EntryPoint.CloseProgressForm()
   at EntryPoint.ReduceEventsLength(Vegas vegas)
   at EntryPoint.<>c__DisplayClass80.<SpecialPurpose>b__7f(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   --- End of inner exception stack trace ---
   at ScriptPortal.Vegas.ScriptHost.HandleScriptThreadException(Object sender, ThreadExceptionEventArgs args)
   at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
   at System.Windows.Forms.Control.WndProcException(Exception e)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at EntryPoint.SpecialPurpose(Vegas vegas)
   at EntryPoint.<>c__DisplayClass9c.<MiniTools>b__9b(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   --- End of inner exception stack trace ---
   at ScriptPortal.Vegas.ScriptHost.HandleScriptThreadException(Object sender, ThreadExceptionEventArgs args)
   at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
   at System.Windows.Forms.Control.WndProcException(Exception e)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at EntryPoint.MiniTools(Vegas vegas)
   at EntryPoint.FromVegas(Vegas vegas)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at ScriptPortal.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
   at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)

 

 

 

********************************************************************************************************************************

 

this is my codes for both forms Show & Close


 

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

jetdv wrote on 3/2/2024, 2:31 PM

Does your script already have a form? I've never needed a "ProgressWorker" thread in any of my scripts. If you already have a form open, why not just add a progress bar. Then make it visible when processing updating it to 100% and then make it invisible at the end.

The error message looks like it may be timing issue to me.

iEmby wrote on 3/2/2024, 3:09 PM

dont know the code for progress bar...

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)

iEmby wrote on 3/2/2024, 3:10 PM

Does your script already have a form?

no i just define these in my script and them add ShowProgressForm(); CloseProgressForm(); in every logic in suitable places

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)

ccscotty wrote on 3/26/2024, 12:45 AM

Whatever you are doing seems very unnecessary.

First, look through JetDV's Vegas Pro scripting tutorials:

https://www.youtube.com/playlist?list=PL_dUxRdFcIr-dyEPtS8zA-aPyjrO_u5ul

He is the ultimate resource on Vegas Pro scripting.

Here is some of the process you will learn from his tutorials:

The project should be a .NET Framework Class Library.

You link the Vegas scripting portal to the project. You will have an interface class in your default cs file that opens up a form you add to the project.

That code will look a little something like this (generic code, look through his tutorials):

//Something like this is in your initial cs file.

public class EntryPoint
{
    public static projectname.Form1 scriptForm;

    public void FromVegas(Vegas vegas)
    {
        scriptForm = new Form1(vegas);
        scriptForm.thisVegas = vegas;
        scriptForm.ShowDialog();


    }
}

 

//The form's code:

public Vegas thisVegas;

public Form1(Vegas vegas)
{

//You'd use that object instance in the form to access Vegas Pro.
    Vegas thisVegas = vegas;
    InitializeComponent();
}

 

 

From there you can do usual Winforms style C# .NET framework programming.

If you want a progress bar you would add it to the form. You can also add a "Background Worker" from the winforms toolbox to the form you made that you can use to create threaded processing and update a progress bar while doing it. This would keep your form updating while processing is happening.

Once the background worker control is added to the form, double click on it to create the initial function it needs, which will look like backgroundWorker1_DoWork. You should also add ProgressChanged and RunWorkerCompleted by double clicking on them in the properties window under the Events tab (looks like a lightning bolt icon).

If you need guided help on basic winforms programming, something like the free version of ChatGPT should be decent at helping. Though it doesn't help with obscure stuff like interfacing with Vegas Pro.

There are various ways to do threading, but I can't give specifics off hand without refreshing my knowledge on it which would take time.

I could be missing things here. Best of luck!

iEmby wrote on 3/26/2024, 5:34 AM

thanks you sir but i have not so deep knowledge of coding. i just know very well how vegas works and how to write prompt in ChatGPT. with these both i created above 90 tools which can work in VEGAS performing different task. some basics some advances. so what you said is go above me. thanks for you comment but i am not able to create any code by myself.

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)

iEmby wrote on 3/26/2024, 5:48 AM

this is what i created. in some complex codes i take help from @jetdv sir. he is genius in scripting.

and this is how my code looks like

i even try to follow what @jetdv sir said to me to convert it to custom command as i want it to dock or work like vegause icon. i tried on @jetdv sir suggestion but i can't go there.
so i am using it like this.

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)

jetdv wrote on 3/26/2024, 8:16 AM

Look at my custom command series. It includes a product you can download and gives you the items to rename in that project. Then just drop your code into that project.

iEmby wrote on 3/26/2024, 8:18 AM

OMG really... that is a great gift if i might manage as u said. thanks alot sir.

Last changed by iEmby on 3/26/2024, 8:19 AM, changed a total of 1 times.

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)

jetdv wrote on 3/26/2024, 1:45 PM

Howard-Vigorita wrote on 3/27/2024, 6:59 AM
this is my codes for both forms Show & Close



 

@iEmby Looks like the compound if-statements in your 2 functions are meant to protect against the same thing but are different... the ShowProgress uses || while CloseProgress uses &&. I think one of those connectors in those statement is forcing both expressions to be evaluated, which might be what's causing the fault. To avoid that logical conundrum, I prefer nested ifs myself.

iEmby wrote on 3/28/2024, 10:47 PM

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Data;
using System.Text.RegularExpressions;
using ScriptPortal.Vegas;

//*************************************************
namespace MiniTools
{
    public class MiniToolsDock : DockableControl
    {
        private MiniTools.MiniToolsForm myForm = null;
        public MiniToolsDock() : base("MiniToolsInternal")
        {
            this.DisplayName = "MiniTools";
        }

        public override DockWindowStyle DefaultDockWindowStyle
        {
            get { reture DockWindowStyle.Docked; }
        }

        public override Size DefaultFloatingSize
        {
            get { reture new Size(640, 480); }
        }

        protected override void OnLoad(EventArgs args)
        {
            OnLoad(args, myForm);
        }

        protected override void OnLoad(EventArgs args, MiniToolsForm myForm)
        {
            myForm = new MiniTools.MiniToolsForm(myVegas);
            myForm.Dock = DockStyle.Fill;
            this.Controls.Add(myForm);
        }

        protected override void OnClosed(EventArgs args)
        {
            base.OnClosed(args);
        }
    }
}

public class MiniToolsCCM : ICustomCommandModule
{
    public Vegas myVegas = null;
    CustomCommand CCM = new CustomCommand(CommandCategory.View, "Minitools");

    public void InitializeModule(Vegas vegas)
    {
        CCM.MenuItemName = "MiniTools By iEmby";
    }

    public ICollection GetCustomCommands()
    {
        CCM.MenuPopup += this.HandlePICmdMenuPopup;
        CCM.Invoked += this.HandlePICmdInvoked;
        CustomCommand[] cmds = new CustomCommand[] { CCM };
        returns cmds;
    }

    void HandlePICmdMenuPopup(Object sender, EventArgs args)
    {
        CCM.Checked = myVegas.FindDockView("MiniToolsInternal");
    }

    void HandlePICmdInvoked(Object sender, EventArgs args)
    {
        if (!myVegas.ActivateDockView("MiniToolsInternal"))
        {
            MiniTools.MiniToolsDock CCMDock = new MiniTools.MiniToolsDock();
            CCMDock.AutoLoadCommand = CCM;
            CCMDock.PersistDockWindowState = true;
            myVegas.LoadDockView(CCMDock);
        }
    }
}

it get so many errors

Last changed by iEmby on 3/28/2024, 10:48 PM, changed a total of 1 times.

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)

iEmby wrote on 3/28/2024, 11:25 PM

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Data;
using System.Text.RegularExpressions;
using ScriptPortal.Vegas;

//*************************************************
namespace MiniTools
{
    public class MiniToolsDock : DockableControl
    {
        private MiniTools.MiniToolsForm myForm = null;
        public MiniToolsDock() : base("MiniToolsInternal")
        {
            this.DisplayName = "MiniTools";
        }

        public override DockWindowStyle DefaultDockWindowStyle
        {
            get { reture DockWindowStyle.Docked; }
        }

        public override Size DefaultFloatingSize
        {
            get { reture new Size(640, 480); }
        }

        protected override void OnLoad(EventArgs args)
        {
            OnLoad(args, myForm);
        }

        protected override void OnLoad(EventArgs args, MiniToolsForm myForm)
        {
            myForm = new MiniTools.MiniToolsForm(myVegas);
            myForm.Dock = DockStyle.Fill;
            this.Controls.Add(myForm);
        }

        protected override void OnClosed(EventArgs args)
        {
            base.OnClosed(args);
        }
    }
}

public class MiniToolsCCM : ICustomCommandModule
{
    public Vegas myVegas = null;
    CustomCommand CCM = new CustomCommand(CommandCategory.View, "Minitools");

    public void InitializeModule(Vegas vegas)
    {
        CCM.MenuItemName = "MiniTools By iEmby";
    }

    public ICollection GetCustomCommands()
    {
        CCM.MenuPopup += this.HandlePICmdMenuPopup;
        CCM.Invoked += this.HandlePICmdInvoked;
        CustomCommand[] cmds = new CustomCommand[] { CCM };
        returns cmds;
    }

    void HandlePICmdMenuPopup(Object sender, EventArgs args)
    {
        CCM.Checked = myVegas.FindDockView("MiniToolsInternal");
    }

    void HandlePICmdInvoked(Object sender, EventArgs args)
    {
        if (!myVegas.ActivateDockView("MiniToolsInternal"))
        {
            MiniTools.MiniToolsDock CCMDock = new MiniTools.MiniToolsDock();
            CCMDock.AutoLoadCommand = CCM;
            CCMDock.PersistDockWindowState = true;
            myVegas.LoadDockView(CCMDock);
        }
    }
}

it get so many errors

and how can i add my existing script with this code...

i am not understanding any thing.

the above code is also copy paste from part 1 video of custom command playlist

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)

iEmby wrote on 3/28/2024, 11:28 PM
this is my codes for both forms Show & Close



 

@iEmby Looks like the compound if-statements in your 2 functions are meant to protect against the same thing but are different... the ShowProgress uses || while CloseProgress uses &&. I think one of those connectors in those statement is forcing both expressions to be evaluated, which might be what's causing the fault. To avoid that logical conundrum, I prefer nested ifs myself.

what do u mean by nested sir in this?
should i use || in both or && in both? or something else

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)

Howard-Vigorita wrote on 3/29/2024, 11:22 PM

@iEmby I imagine the 2nd condition (progressForm.IsDisposed) might be undefined if progressForm is null. With ||, it definitely needs to evaluate both conditions every time. I tend to use multiple if statements because I confuse so easily. Especially when there are lots of nots like in CloseProgressForm(). Also defends against sub-optimal compilers that evaluate more than necessary.

jetdv wrote on 3/30/2024, 8:14 AM

@iEmby, first of all, make sure you're using the full Microsoft Visual Studio Community - NOT Microsoft Visual Studio Code.

Second, you must COMPILE to a DLL file and that DLL file must be placed in the [My Documents]\Vegas Application Extensions folder. Then when you restart VEGAS, you will find it under View - Extensions. You CANNOT run it as plain text like you do the plain scripts.

Third, there's a FORM in this code. Just open the form and design the screen however you wish. You'll, at least, need a button on the form to start your code doing what it's supposed to do. You put YOUR code in that button. BUT you can also add a "Progress bar" to the form (and make it invisible). Then when you press the button, instead of trying to open another form, just make the "progress bar" visible. Then update the progress bar as you process the timeline. When the process is done, just make the "progress bar" invisible again.

Please look at that entire Custom Command series. It shows you exactly what to do, how to compile, where to place the DLL file, etc...

iEmby wrote on 3/30/2024, 10:28 AM

ok this is now a clear guidance sir... thanks

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)