When a script is run, can I prompt to have the user enter information? I tried the "input" function for javascript, but it doesn't seem to know what that is.
var Input : UserInputForm = new UserInputForm();
Input.ShowDialog();
public class UserInputForm extends System.Windows.Forms.Form
{
private var label1 : System.Windows.Forms.Label;
private var textBox1 : System.Windows.Forms.TextBox;
private var button1 : System.Windows.Forms.Button;
private var components : System.ComponentModel.Container = null;
public function UserInputForm()
{
InitializeComponent();
}
//Clean up any resources being used.
protected override function Dispose(disposing : Boolean)
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
super.Dispose( disposing );
}
private function InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 39);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 23);
this.label1.TabIndex = 0;
this.label1.Text = "Input:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(72, 40);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(248, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(248, 80);
this.button1.Name = "button1";
this.button1.TabIndex = 2;
this.button1.Text = "OK";
this.button1.add_Click(this.button1_Click);
//
// UserInputForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(336, 118);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Name = "UserInputForm";
this.Text = "UserInputForm";
this.ResumeLayout(false);
}
private function button1_Click(sender : Object , e : System.EventArgs)
{
this.Close();
}
}
Inputing a value in VB is quite easy using the InputBox function. See below
Imports Sony.Vegas
Imports System.Windows.Forms
Public Module MainModule
Dim Valeur as String
Dim Reponse as Integer
Dim ValeurInt as Integer
Dim Start as String
Dim Counter as Integer
Public Sub Main()
Counter = 0
Reponse = CInt(Int((100 * Rnd()) + 1))
Chiffres()
End Sub
Public Sub Chiffres()
Counter = Int(Counter + 1)
Valeur = InputBox("Enter a number between 1 and 100")
ValeurInt = CInt(Valeur)
Teste()
End Sub
Public Sub Teste()
If ValeurInt = Reponse Then
MessageBox.Show("Good answer ! " & Counter & " attempts")
Debut()
ElseIf ValeurInt < Reponse Then
MessageBox.Show("Higher")
Chiffres()
Else
MessageBox.Show("Lower")
Chiffres()
End If
End Sub
Public Sub Debut()
Start = InputBox("Continue ? (Type Yes or No)")
If Start = "Yes" Then
Main()
ElseIf Start = "yes" Then
Main()
End If
End Sub
I need to prompt a user for input in a script. I came across this script from roger 74. The script works but I don't know how to get the user input assigned to a variable that I could use in the script. I have never worked with Forms before. Could someone help me out with this? Thx.