Results 1 to 15 of 15

Thread: Batch Coder / Compiler [Source]

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    49

    Talking Batch Coder / Compiler [Source]




    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
    Last edited by si_the_geek; Aug 9th, 2011 at 01:01 PM. Reason: removed link to executable file

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Batch Coder / Compiler [Source]

    So....

    Care to explain why you have posted that? An admin will come along soon and remove the .exe link. None are allowed on the forums.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Batch Coder / Compiler [Source]

    I looked through the posted code... it is suspect for sure... it tries to download something off the internet... when it claims to be "compiling" .... the "compile" routine is just a simply delay loop (presumably while the suspect url loads into the webbrowser).

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Batch Coder / Compiler [Source]

    It is an online tool to convert a bat file to a .exe, which remarkably does actually work (tested it on a sandbox). I have to guess that the OP ment to put this into the codebank, but as there is no comments....

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    49

    Re: Batch Coder / Compiler [Source]

    Thanks for the reply, and I don't really go on these forums as you can see so I didn't know 7-zip files are against the rules.

    I'll take my business else were.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Batch Coder / Compiler [Source]

    Quote Originally Posted by Smasherx74 View Post
    I didn't know 7-zip files are against the rules.
    They aren't. Admittedly they aren't a good idea tho, because they severely limit the amount of people who can look at it (.zip files are much better, as almost everyone can open them).


    What is a problem is the executable file that it contains, because we have no way of knowing what an executable file actually does - which could include something malicious, such as if there is a virus on your computer.

    In addition to that, a compiled program (as opposed to code) does nothing towards helping us to assist you... assuming that there was meant to be some kind of question.

  7. #7
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Batch Coder / Compiler [Source]

    Zip files are Ok, it is compiled .exe files that are frowned upon. It would have been better had you explained what this application is for, and how it does it. Then it can go in the code bank for others to use. Having just a link and code without any explaination causes us to ask questions, it could have been a request for help. I am sure one day someone might use the concept of requesting and downloading files.

  8. #8

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    49

    Re: Batch Coder / Compiler [Source]

    I provided the .exe file so if you wanted to you could use it. It's already scanned on Virustotal.com but I just released source for the public so it doesn't matter.

    Also 7-zip is much better then .zip and winrar. It compresses files much smaller and I use it all the time now to hopefully get everyone else to use it.

  9. #9
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Batch Coder / Compiler [Source]

    Quote Originally Posted by Smasherx74 View Post
    Also 7-zip is much better then .zip and winrar. It compresses files much smaller and I use it all the time now to hopefully get everyone else to use it.
    The average example I create is 12 KB zipped once I've stripped the executables and other miscellaneous files. 7-zip manages to compress it down to 6-8 KB. Zip is ubiquitous since Windows XP onwards has it built in. Is it worth saving 4-6 KB on your zip file if a user has to download a 1 MB file and install a new application? They'd have to download nearly 100 .7z files to make up the difference. From where I sit, that's less efficient; 90% of forum members probably download 10 attachments in their lifetime.

  10. #10

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    49

    Re: Batch Coder / Compiler [Source]

    Why do you got to be so serious?

  11. #11
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Batch Coder / Compiler [Source]

    Because this isn't Chit-Chat ... and this board has been burned before by posters with bad intentions posting things (which is why compiled code isn't allowed) ... and to be honest, while some aspects of 7-zip are superior to standard zip, it's still not in common use. At some level everyone has access to winzip, so that's the standard around here. I happen to have 7zip because I use it in my day to day job... but that doesn't mean I post 7zip files... I'm respectful that others may not have discovered it and/or are able to download (believe it or not, there are some companies out there that prevent the installation of non-standard software). But winzip is baked into Windows...

    I could create a new zip format TG-Zip ... and it might be able to compress data down to 1k ... but unless everyone else also has TG-Zip, it doesn't do any good to post tgzip files.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  12. #12
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Batch Coder / Compiler [Source]

    Quote Originally Posted by Smasherx74 View Post
    Why do you got to be so serious?
    Because the internet is serious business.

    Honestly I'm trying to help you. Speaking for myself, if a user posts a .7z file I'm 99% likely to ignore the post unless it seems really interesting or fun. I know many, many people who feel the same way. Most of us are taking time out of our workday to help with your project, and everything you do to make it more difficult helps us remember we have things we're *supposed* to be doing instead.

    It's like you're sending out HD-DVDs of a movie when the world's already moved on to Blu-Ray. Any technical advantages of HD-DVD are irrelevant when no one has a player for the format. Going back a generation, you're advocating Betamax instead of VHS. Sometimes the best format doesn't win, but using the one that lost means few people will be able to use your stuff.

  13. #13

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    49

    Re: Batch Coder / Compiler [Source]

    Quote Originally Posted by Sitten Spynne View Post
    Because the internet is serious business.

    Honestly I'm trying to help you. Speaking for myself, if a user posts a .7z file I'm 99% likely to ignore the post unless it seems really interesting or fun. I know many, many people who feel the same way. Most of us are taking time out of our workday to help with your project, and everything you do to make it more difficult helps us remember we have things we're *supposed* to be doing instead.

    It's like you're sending out HD-DVDs of a movie when the world's already moved on to Blu-Ray. Any technical advantages of HD-DVD are irrelevant when no one has a player for the format. Going back a generation, you're advocating Betamax instead of VHS. Sometimes the best format doesn't win, but using the one that lost means few people will be able to use your stuff.
    I fully understand and thank you for the reply.

  14. #14
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Batch Coder / Compiler [Source]

    As to the OP, is this something that could do with existing in the codebank?

  15. #15
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Batch Coder / Compiler [Source]

    If this thread was just meant as code for others to use (rather than a request for some kind of assistance), the CodeBank would be the place to post it.

    If that is the case, I recommend creating a new thread there (as this one is now rather cluttered with "irrelevant" posts), including the same info as there is in the first post, plus an explanation of what the code is used for.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width