I put forward the Control Panel process because some others on the forum over the years have reported installing .NET Framework directly from Microsoft's website didn't work whereas the more complicated Control Panel process did work.
@Grazie One is Automatic, the other is manually doing it yourself.... Personally, i simply always go to the link bitman provided and download what i want, and keep a copy of the installer as backup.
I don't know why the compiled version is not working. If you want to try a non-compiled version, here's the script you can save as "Find Regions by Name.cs" and then remove the .dll file and put this .cs file there instead. But the compiled version is still working fine on my systems.
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ScriptPortal.Vegas;
namespace Test_Script_With_Form
{
public partial class Form1 : Form
{
public Vegas myVegas;
public Form1(Vegas vegas)
{
myVegas = vegas;
InitializeComponent();
int numRegions = myVegas.Project.Regions.Count;
if (numRegions == 0)
{
MessageBox.Show("There are no regions in this project.");
return;
}
foreach (ScriptPortal.Vegas.Region myRegion in myVegas.Project.Regions)
{
cmbMarkers.Items.Add(myRegion.Label);
}
}
private void button1_Click(object sender, EventArgs e)
{
ScriptPortal.Vegas.Region myRegion = myVegas.Project.Regions[cmbMarkers.SelectedIndex];
myVegas.Transport.CursorPosition = myRegion.Position;
myVegas.Transport.SelectionStart = myRegion.Position;
myVegas.Transport.SelectionLength = myRegion.Length;
if (chkZoom.Checked)
{
myVegas.Transport.ZoomSelection();
}
this.Close();
}
private void Form1_Resize(object sender, EventArgs e)
{
cmbMarkers.Width = Form1.ActiveForm.Width - 90;
}
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.cmbMarkers = new System.Windows.Forms.ComboBox();
this.chkZoom = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 40);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(46, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Regions";
//
// button1
//
this.button1.Location = new System.Drawing.Point(119, 164);
this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(151, 31);
this.button1.TabIndex = 2;
this.button1.Text = "Find Region";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// cmbMarkers
//
this.cmbMarkers.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.cmbMarkers.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.cmbMarkers.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbMarkers.FormattingEnabled = true;
this.cmbMarkers.Location = new System.Drawing.Point(61, 37);
this.cmbMarkers.Name = "cmbMarkers";
this.cmbMarkers.Size = new System.Drawing.Size(335, 28);
this.cmbMarkers.TabIndex = 3;
//
// chkZoom
//
this.chkZoom.AutoSize = true;
this.chkZoom.Checked = true;
this.chkZoom.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkZoom.Location = new System.Drawing.Point(61, 97);
this.chkZoom.Name = "chkZoom";
this.chkZoom.Size = new System.Drawing.Size(203, 17);
this.chkZoom.TabIndex = 4;
this.chkZoom.Text = "Zoom the selection area to this region";
this.chkZoom.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(408, 206);
this.Controls.Add(this.chkZoom);
this.Controls.Add(this.cmbMarkers);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "Form1";
this.Text = "Select Region by Name";
this.Resize += new System.EventHandler(this.Form1_Resize);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox cmbMarkers;
private System.Windows.Forms.CheckBox chkZoom;
}
}
public class EntryPoint
{
private static Test_Script_With_Form.Form1 form;
public void FromVegas(Vegas vegas)
{
form = new Test_Script_With_Form.Form1(vegas);
form.ShowDialog();
}
}
I copied your text into a new Notepad and named it as you said. I then renamed the OLD dll as OLD, I didn't remove it. Rescan the Script Menu - no luck.
I can't tell you why either. It's all working fine here. What error message are you getting with the .CS file (and make sure you ARE using the .CS file!)
I was able to duplicate the error on my Win10 machine (the code above runs fine on my Win 11 machine).
The error appears to be caused by this line:
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
Simply changing that line to this solves the problem (so would deleting it):
//this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
I'm not sure why that line is causing the problem but do know that it fixes the issue. I'm guessing it's related to a Win 10 update as it used to work fine on Win 10 as well as Win 11 and that's a Visual Studio generated line. Interestingly, another script with that exact same line present works fine so I'm not sure what's happening here but getting rid of (or commenting out) that one line does allow it to work.
Interestingly, another script with that exact same line present works fine so I'm not sure what's happening here but getting rid of (or commenting out) that one line does allow it to work.
This sounds vaguely familiar, where I thrashed around with default fonts and HighDPI.