by Smasherx74
vb.net Batch Coder / Compiler Fffffffl


Source

Code:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     
        SaveFileDialog1.Title = "Save"
        SaveFileDialog1.Filter = "Batch File (*.bat)|*.bat"
        If SaveFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
            RichTextBox1.SaveFile(SaveFileDialog1.FileName, Windows.Forms.RichTextBoxStreamType.PlainText)
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SaveFileDialog1.FileName = "Test.bat"
        RichTextBox1.SaveFile(SaveFileDialog1.FileName, Windows.Forms.RichTextBoxStreamType.PlainText)


        Dim response As New DialogResult
        response = MessageBox.Show("Testing batch file will run the .bat file. Whatever the code does will be executed on your computer, are you sure you want to continue?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If response = DialogResult.Yes Then
            Process.Start("Test.bat")
        Else

        End If

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        RichTextBox1.Text = ""

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Form2.ShowDialog()
    End Sub


    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        SaveFileDialog1.FileName = "Project.bat"
        RichTextBox1.SaveFile(SaveFileDialog1.FileName, Windows.Forms.RichTextBoxStreamType.PlainText)


        If WebBrowser1.ReadyState = WebBrowserReadyState.Complete = True Then
            WebBrowser1.Document.GetElementById("userfile").InvokeMember("click")
            Threading.Thread.Sleep(100)
            For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
                If elem.GetAttribute("value") = "Convert" Then
                    elem.InvokeMember("click")
                End If

            Next
        End If


        Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
        Dim dblWaitTil As Date
        Now.AddSeconds(OneSec)
        dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(10)
        Do Until Now > dblWaitTil
            MsgBox("Compiling Batch file please wait...", MsgBoxStyle.Information)
        Loop

        If WebBrowser1.ReadyState = WebBrowserReadyState.Complete = True Then
            For Each unit As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
                If unit.InnerText = "Download" Then
                    unit.InvokeMember("click")
                End If
            Next
        End If

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("http://www.f2ko.de/programs.php?lang=en&pid=ob2e")
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If TextBox1.Text = "0" Then
            RichTextBox1.BackColor = Color.Black
        End If

        If TextBox1.Text = "1" Then
            RichTextBox1.BackColor = Color.Blue
        End If

        If TextBox1.Text = "2" Then
            RichTextBox1.BackColor = Color.Green
        End If

        If TextBox1.Text = "3" Then
            RichTextBox1.BackColor = Color.Aqua
        End If

        If TextBox1.Text = "4" Then
            RichTextBox1.BackColor = Color.Red
        End If

        If TextBox1.Text = "5" Then
            RichTextBox1.BackColor = Color.Purple
        End If

        If TextBox1.Text = "6" Then
            RichTextBox1.BackColor = Color.Yellow
        End If

        If TextBox1.Text = "7" Then
            RichTextBox1.BackColor = Color.White
        End If

        If TextBox1.Text = "8" Then
            RichTextBox1.BackColor = Color.Gray
        End If

        If TextBox1.Text = "9" Then
            RichTextBox1.BackColor = Color.Blue
        End If

        If TextBox1.Text = "A" Then
            RichTextBox1.BackColor = Color.Green
        End If

        If TextBox1.Text = "B" Then
            RichTextBox1.BackColor = Color.Aqua
        End If

        If TextBox1.Text = "C" Then
            RichTextBox1.BackColor = Color.Red
        End If

        If TextBox1.Text = "D" Then
            RichTextBox1.BackColor = Color.Purple
        End If

        If TextBox1.Text = "E" Then
            RichTextBox1.BackColor = Color.Yellow
        End If

        If TextBox1.Text = "F" Then
            RichTextBox1.BackColor = Color.White
        End If
        If TextBox2.Text = "0" Then
            RichTextBox1.ForeColor = Color.Black
        End If

        If TextBox2.Text = "1" Then
            RichTextBox1.ForeColor = Color.Blue
        End If

        If TextBox2.Text = "2" Then
            RichTextBox1.ForeColor = Color.Green
        End If

        If TextBox2.Text = "3" Then
            RichTextBox1.ForeColor = Color.Aqua
        End If

        If TextBox2.Text = "4" Then
            RichTextBox1.ForeColor = Color.Red
        End If

        If TextBox2.Text = "5" Then
            RichTextBox1.ForeColor = Color.Purple
        End If

        If TextBox2.Text = "6" Then
            RichTextBox1.ForeColor = Color.Yellow
        End If

        If TextBox2.Text = "7" Then
            RichTextBox1.ForeColor = Color.White
        End If

        If TextBox2.Text = "8" Then
            RichTextBox1.ForeColor = Color.Gray
        End If

        If TextBox2.Text = "9" Then
            RichTextBox1.ForeColor = Color.Blue
        End If

        If TextBox2.Text = "A" Then
            RichTextBox1.ForeColor = Color.Green
        End If

        If TextBox2.Text = "B" Then
            RichTextBox1.ForeColor = Color.Aqua
        End If

        If TextBox2.Text = "C" Then
            RichTextBox1.ForeColor = Color.Red
        End If

        If TextBox2.Text = "D" Then
            RichTextBox1.ForeColor = Color.Purple
        End If

        If TextBox2.Text = "E" Then
            RichTextBox1.ForeColor = Color.Yellow
        End If

        If TextBox2.Text = "F" Then
            RichTextBox1.ForeColor = Color.White
        End If

    End Sub
End Class