as i share my new tool for quick rendering in VEGAS for main streams and Social Media Stremes
https://vegasprofreetools.blogspot.com/p/scripts.html
QUICK RENDER
as i share this build link. it is working good but after i may be made some mistake or i don know but main tool is not working on unsaved projects.
as i created some code for that like if user run this tool on unsaved project (new project) it will ask to save or not. if u select save it will show you save as dialog if u select no it will create a temporary project in a folder named temporary project at desktop for emergency need.
but it is working now only on saved genuine saved project.
like this.
this is my starting of code
using ScriptPortal.Vegas; using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Windows.Forms; namespace Quick_Render_by_iEmby { public partial class QRend : Form { public Vegas vegas; private string projectPath; private string renderDirectory; bool OverwriteExistingFiles = false; private Dictionary<Track, TrackState> trackStates = new Dictionary<Track, TrackState>(); public QRend(Vegas vegas) { InitializeComponent(); this.vegas = vegas; if (!IsProjectSaved()) { MessageBox.Show("Please save the project before using this script."); this.Close(); return; } FillTemplates(otherTemplatesCombo); selectionBox.Checked = true; selectionBox.CheckedChanged += CheckBox_CheckedChanged; regionsBox.CheckedChanged += CheckBox_CheckedChanged; videotracksBox.CheckedChanged += CheckBox_CheckedChanged; audiotracksBox.CheckedChanged += CheckBox_CheckedChanged; withoutAudioBox.CheckedChanged += CheckBox_CheckedChanged; bool projectContainsAudio = false; foreach (Track track in vegas.Project.Tracks) { if (track.IsAudio()) { foreach (TrackEvent trackEvent in track.Events) { if (trackEvent.IsAudio()) { projectContainsAudio = true; break; } } } if (projectContainsAudio) { break; } } if (!projectContainsAudio) { withoutAudioBox.Enabled = false; } else { withoutAudioBox.Enabled = true; } if (vegas.Project.Regions.Count > 0) { regionsBox.Enabled = true; } else { regionsBox.Enabled = false; } projectPath = Path.GetDirectoryName(vegas.Project.FilePath); renderDirectory = Path.Combine(projectPath, "Renders"); if (!Directory.Exists(renderDirectory)) { Directory.CreateDirectory(renderDirectory); } } private bool IsProjectSaved() { if (string.IsNullOrEmpty(vegas.Project.FilePath)) { return false; } else { return true; } }
and this is the ending of my script
public class EntryPoint { private static Quick_Render_by_iEmby.QRend form; public void FromVegas(Vegas vegas) { form = new Quick_Render_by_iEmby.QRend(vegas); form.ShowDialog(); } }
I don't think other parts may be the problem.
as i asked ChatGPT. it says u r trying to run something which is already disposed off.
Even i tried to add this code still same crashes and errors
public QRend(Vegas vegas) { InitializeComponent(); this.vegas = vegas; // Check if the project is untitled and unsaved if (vegas.Project == null || string.IsNullOrEmpty(vegas.Project.FilePath)) { // Display a message box indicating that the project is unsaved DialogResult dialogResult = MessageBox.Show( "PLEASE SAVE YOUR PROJECT FIRST !!\n\nDo you want to save it now?", "ATTENTION", MessageBoxButtons.YesNo, MessageBoxIcon.Warning ); if (dialogResult == DialogResult.Yes) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Vegas Project Files (*.veg)|*.veg"; saveFileDialog.Title = "Save As Project"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { vegas.SaveProject(saveFileDialog.FileName); } else { return; } } else { // Define the folder and base file name string outputFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Rendering Projects"); string outputFileName = "Not_Saved_Project_Render"; // Create the folder if it doesn't exist Directory.CreateDirectory(outputFilePath); // Find an available file name by appending a counter string filePath = Path.Combine(outputFilePath, outputFileName + ".veg"); int counter = 1; while (File.Exists(filePath)) { filePath = Path.Combine(outputFilePath, outputFileName + "_" + counter + ".veg"); // Add parentheses around the counter counter++; } // Save a copy of the project with the specified name vegas.Project.SaveProject(filePath); } } FillTemplates(otherTemplatesCombo); selectionBox.Checked = true; selectionBox.CheckedChanged += CheckBox_CheckedChanged; regionsBox.CheckedChanged += CheckBox_CheckedChanged; videotracksBox.CheckedChanged += CheckBox_CheckedChanged; audiotracksBox.CheckedChanged += CheckBox_CheckedChanged; withoutAudioBox.CheckedChanged += CheckBox_CheckedChanged; bool projectContainsAudio = false; foreach (Track track in vegas.Project.Tracks) { if (track.IsAudio()) { foreach (TrackEvent trackEvent in track.Events) { if (trackEvent.IsAudio()) { projectContainsAudio = true; break; } } } if (projectContainsAudio) { break; } } if (!projectContainsAudio) { withoutAudioBox.Enabled = false; } else { withoutAudioBox.Enabled = true; } if (vegas.Project.Regions.Count > 0) { regionsBox.Enabled = true; } else { regionsBox.Enabled = false; } projectPath = Path.GetDirectoryName(vegas.Project.FilePath); renderDirectory = Path.Combine(projectPath, "Renders"); if (!Directory.Exists(renderDirectory)) { Directory.CreateDirectory(renderDirectory); } }
Don't know where i am wrong. NEED HELP