Welcome, Guest. Please login or register. Did you miss your activation email?
Britec Computer Tech Help Support Forums  « Microsoft Support  « Windows 7 Support  « Visual Basic 2010 Progress Bar for Batch File.
Pages: [1]
  Print  
Author Topic: Visual Basic 2010 Progress Bar for Batch File.  (Read 714 times)
Metroidn1f
Jr. Member
**
Posts: 51



View Profile
« on: July 03, 2010, 12:27:28 PM »

Hey, I am making a real GUI with Visual Basic 2010, and the GUI is for encoding videos.  It uses x264 a long with other useful audio and demux applications.  They are all CLI, but I was wondering, how would I show the progress of lets say the progress of a x264 encode in a window or what ever made with vb?  I don't think I explained it good enough.  You know when you use any other video or audio encoder, and it shows you the progress of where it is so far?  How do you do that?  THe programs that it uses are usually CLI like x264 or BeSweet.
Logged

I might only be 16, but I am really smart with computers!
Metroidn1f
Jr. Member
**
Posts: 51



View Profile
« Reply #1 on: July 03, 2010, 04:17:20 PM »

Okay then.  How do I create a text file and write to it?
Logged

I might only be 16, but I am really smart with computers!
Britec
Administrator
Hero Member
*****
Posts: 3346



View Profile
« Reply #2 on: July 03, 2010, 04:20:47 PM »

Youtube say's This account is suspended. for Metroidn1f  Shocked
Logged



Britec
Administrator
Hero Member
*****
Posts: 3346



View Profile
« Reply #3 on: July 03, 2010, 04:24:12 PM »

I am sorry, I dont really understand what your asking.
Logged



Metroidn1f
Jr. Member
**
Posts: 51



View Profile
« Reply #4 on: July 03, 2010, 04:38:20 PM »

Ya, I don't know how that account got suspended, I really don't.  My current one is Here

I can live with out having a progress bar.  But how do I create a text file and write commands to it so I can run it?  I am using BC 2010, but it should be pretty much the same as 2008.  Do you know?  Or is there a way where I can just run commands from vb its self instead of making the batch file?
Logged

I might only be 16, but I am really smart with computers!
Metroidn1f
Jr. Member
**
Posts: 51



View Profile
« Reply #5 on: July 03, 2010, 08:47:54 PM »

Could someone please look over this?  I will explain on what it is suppose to do at the end of this post.


Public Class MainPage

    Private Sub MakeFileMkvD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MakeFileMkvD.Click
        Dim TrkInptMkvD 'Track Input for Mkv Demuxer.
        Dim VOtPtMkvD 'Video Output for Mkv Demuxer.
        Dim AOtPtMkvD 'Audio Output for Mkv Demuxer.
        Dim VIDMkvD 'Video ID for Mkv Demuxer.
        Dim AIDMkvD 'Audio ID for Mkv Demuxer.
        Dim MkvDQ 'Confirmation Of Deleting Already Existed Video Output File.
        Dim MkvDLoop 'Variable For While Loop.
        Dim MkvNulD 'Varaible so Null Can be Used.  Experimental
        TrkInptMkvD = VideoInputBoxMkvD.Text
        VOtPtMkvD = AudioOutputBoxMkvD.Text
        AOtPtMkvD = VideoOutputBoxMkvD.Text
        VIDMkvD = VideoIDMkvD.Text 'Temp: System.Diagnostics.Process.Start(Environ$("Temp") & "\MkvMakeFileD.bat")
        AIDMkvD = AudioIDMkvD.Text
        MkvDLoop = 0
        MkvNulD = "Nul"
        While MkvDLoop < 1
            If Not My.Computer.FileSystem.FileExists("'" & TrkInptMkvD & "'") Then
                MsgBox("The file, " & TrkInptMkvD & " does not exist", vbExclamation + vbOKOnly, "File Does Not Exist")
                MkvDLoop = MkvDLoop + 1
            End If
            If My.Computer.FileSystem.FileExists("'" & VOtPtMkvD & "'") Then
                MkvDQ = MsgBox("The file, " & VOtPtMkvD & " already exists.  Do you want to delete it?", vbQuestion + vbYesNo, "File Already Exists")
                If MkvDQ = vbYes Then
                    Kill("'" & VOtPtMkvD & "'")
                    Shell(Environ$("Comspec") & " /c Echo @Echo Off>> '%Temp%\MkvMakeFileD.bat'")
                    Shell(Environ$("Comspec") & " /c Echo Color 0B>> '%Temp%\MkvMakeFileD.bat'")
                    Shell(Environ$("Comspec") & " /c Echo mkvextract tracks " & TrkInptMkvD & " " & VIDMkvD & ":'" & VOtPtMkvD & "' " & AIDMkvD & ":'" & AOtPtMkvD & "'>> '%Temp%\MkvMakeFileD.bat'")
                Else
                    End
                End If
                MkvDLoop = MkvDLoop + 1
            End If
            Shell(Environ$("Comspec") & " /c Echo @Echo Off>> '%Temp%\MkvMakeFileD.bat'")
            Shell(Environ$("Comspec") & " /c Echo Color 0B>> '%Temp%\MkvMakeFileD.bat'")
            Shell(Environ$("Comspec") & " /c Echo mkvextract tracks " & TrkInptMkvD & " " & VIDMkvD & ":'" & VOtPtMkvD & "' " & AIDMkvD & ":'" & AOtPtMkvD & "'>> '%Temp%\MkvMakeFileD.bat'")
            MkvDLoop = MkvDLoop + 1
        End While
    End Sub
End Class






What it does is, I have the gui to ask me where the file is that I want to demux, (It is mkv).  Then I tell it where to output the audio and audio, and beside it, I list the track ID.  THen I click the make file button, and that is where that scripts comes in.  First it checks to see if the input file exists, and if it doesn't, they MkvDLopp = MkvDLoop + 1 end the loop causing the sub to end.

If the file exists, it will check if the output video file exits.  If it does, I will prompted if I want to delete it.  If I click yes, it will delete and it will go ahead and make the batch file.  If I click no, (Now were in the first else) it ends then the MkvDLopp = MkvDLoop + 1 comes into place again, and cancel the loop causing the sub to end.

If in the first place the Output video file did not exists, it would go ahead and make the batch file.

Yes I have realized that I have not specified to check and see if the audio output file exists, but I know it doesn't.

I have a feeling I do not have the MkvDLopp = MkvDLoop + 1 set up or put in the right spot to end the while loop.

When ever I run it, it always says that the file that I had input, does not exist, but I know it does.  The reason why I think I have put the MkvDLopp = MkvDLoop + 1 in the correct way or right place is because, after I click okay when I get that message, the command prompt pops quickly.  I then go to the %Temp% directory and I do not see the MkvMkaeFIleD.bat anywhere.

I know what I am about to give you might not help, but it will if you understand.  It will aid you with on if I have the script right to compare it with what the inside of the batch file should look like.

The input fie is:
C:\Users\Metroidn1f\Downloads\Movies\Exam 2009 720p BluRay x264\avchd-exam.2009.720p.mkv

Video output is:
C:\Test.264
       and the track ID is 1

THe Audio output is:
C:\Test.ac3
       and the track ID is 2

The inside of the batch file should look like this.

@Echo Off
Color 0B
mkvextract tracks "C:\Users\Metroidn1f\Downloads\Movies\Exam 2009 720p BluRay x264\avchd-exam.2009.720p.mkv" 1:"C:\Test.264" 2:"C:\Test.ac3"

ANd take note, where ever you see something like this '" it is just not one quote (") It is ' and a ".  Same button, but one is just shifted.

Sorry if this confuses you.  But I am just really stumped.  This is my first application that I have actually attempted to make.
Logged

I might only be 16, but I am really smart with computers!
Britec
Administrator
Hero Member
*****
Posts: 3346



View Profile
« Reply #6 on: July 04, 2010, 07:37:28 AM »

Your best bet is to join one of them Programming Forums Community for Programmers and Developers with experts in C++, C#, Visual Basic, Java, Javascript, CGI, HTML and More!
Logged



Metroidn1f
Jr. Member
**
Posts: 51



View Profile
« Reply #7 on: July 04, 2010, 12:31:19 PM »

Okay.  I figured it out.

Do you know how to use quotes inside of quotes?  For example.

Say I had:

Shell(Environ$("Comspec") & " /c Echo @Echo Off>> C:\New Folder\MkvMakeFileD.bat")

The last part needs to be in quotes too or it will just output to C:\New.  I tried using ' but that did not work.  Do you have a solution?
Logged

I might only be 16, but I am really smart with computers!
Pages: [1]
  Print  
 
Jump to: