1. #1
    GZ's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,923
    • specs System Specs
      • Manufacturer:
        GZ Technologies LLC
      • Model Number:
        Phenom-INAL
      • Motherboard:
        ASUS M5A97-EVO
      • CPU:
        AMD PhenomII x6 (1100T)
      • Memory:
        16GB Kingston Hyper-X blu PC3-12800
      • Graphics:
        XFX Radeon HD6770
      • Sound Card:
        Realtek ALC892
      • Hard Drives:
        500GB WD Caviar Black / 1TB WD Caviar Black / 1TB Seagate / 500GB Hitachi
      • Disk Drives:
        HP DVD 1270i SATA DVD RW
      • Power Supply:
        Corsair 850TX
      • Case:
        Antec 300
      • Cooling:
        Coolermaster V8 / 2x 12CM intake / 1x 12CM rear exhaust / 1x 14CM top exhaust
      • Display:
        Acer 23in 1920x1080 / Acer 20in
      • Operating System:
        Microsoft Windows 8 Professional x64

    VB Project... To help me learn

    Okay... So I am trying to learn VB...

    I came up with (what should be) a simple program to help me learn how things work... If you all wouldn't mind helping me get started.

    My understanding of the language is sketchy at best. I have my wife to help me, but she gets short with me quickly. Last night I asked her for help and she gave me a short answer followed with "I don't understand why you can't... blah... blah... blah". So I set out to figure it out on my own and ended up writing a batch script to do what I wanted (change directory focus before executing a program) instead of having subroutine do it.

    Of course Visual Studio doesn't really help me too much... It's like using an HTML editor to write a page, vs. manually doing it. But that is how I learned HTML. I want to try and do the same thing here... Use VS10 to design most of the program then read the code to figure out what it does. (with help from the WWW).

    Okay. What I want to do...

    I have a file directory of karaoke songs (CDG+MP3) and a tab-delimited text file with the file names and the Song Artist/Title. Instead of manually renaming each of the 2000+ files I would like to write a program to do it for me.

    Later on, I would like to add the functionality to compress both the .mp3 & .cdg files into zip containers using the same artist/title filename.


    Please, if you have any comments or tips to help me get started and going in the right direction, feel free to throw in your two cents!

    "Among the tales of sorrow and of ruin that come down to us from the darkness of those days there are yet some in which amid weeping there is joy and under the shadow of death light that endures."

    J.R.R. Tolkien - The Silmarillion


    • Ad Bot

      advertising
      Beep.

        
       

  2. #2
    GZ's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,923
    • specs System Specs
      • Manufacturer:
        GZ Technologies LLC
      • Model Number:
        Phenom-INAL
      • Motherboard:
        ASUS M5A97-EVO
      • CPU:
        AMD PhenomII x6 (1100T)
      • Memory:
        16GB Kingston Hyper-X blu PC3-12800
      • Graphics:
        XFX Radeon HD6770
      • Sound Card:
        Realtek ALC892
      • Hard Drives:
        500GB WD Caviar Black / 1TB WD Caviar Black / 1TB Seagate / 500GB Hitachi
      • Disk Drives:
        HP DVD 1270i SATA DVD RW
      • Power Supply:
        Corsair 850TX
      • Case:
        Antec 300
      • Cooling:
        Coolermaster V8 / 2x 12CM intake / 1x 12CM rear exhaust / 1x 14CM top exhaust
      • Display:
        Acer 23in 1920x1080 / Acer 20in
      • Operating System:
        Microsoft Windows 8 Professional x64

    Re: VB Project... To help me learn

    Let's see if I have the gist of how this should work.

    The program will need to...

    Read the tab delimited file
    Assign variables to the file entries
    Use those variables to locate the files and rename them.

    The subprocess commands should be something like...

    Code:
    My.Computer.FileSystem.RenameFile("FileName.file", "NewFileName.file")
    or
    Code:
    My.Computer.FileSystem.RenameFile("Variable1", "Variable01")
    Am I on the right track, or am I out in left field?

    "Among the tales of sorrow and of ruin that come down to us from the darkness of those days there are yet some in which amid weeping there is joy and under the shadow of death light that endures."

    J.R.R. Tolkien - The Silmarillion

  3. #3
    niemiro's Avatar
    Join Date
    Mar 2012
    Location
    District 12
    Posts
    7,827

    Re: VB Project... To help me learn

    Hello!

    You seem to be picking up programming really quickly :)

    I will need to check up how to access the designer produced code from your other thread - I know how to do it in C#, but I have a suspicion that it is different in VB.

    Basically, the gist of it is that you are going to have to create an array of old names, and an array of new names, loop through the old names, and convert each to the new name.

    What format exactly does this file take? It is something like (with \t for a tab, and \r\n for a newline)

    Old_Name\tNew_Name\tArtist\r\n...{Next_Entry}...

    I can then talk you through it. Very well done for the impressive results you have already achieved.

    Richard

  4. #4
    GZ's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,923
    • specs System Specs
      • Manufacturer:
        GZ Technologies LLC
      • Model Number:
        Phenom-INAL
      • Motherboard:
        ASUS M5A97-EVO
      • CPU:
        AMD PhenomII x6 (1100T)
      • Memory:
        16GB Kingston Hyper-X blu PC3-12800
      • Graphics:
        XFX Radeon HD6770
      • Sound Card:
        Realtek ALC892
      • Hard Drives:
        500GB WD Caviar Black / 1TB WD Caviar Black / 1TB Seagate / 500GB Hitachi
      • Disk Drives:
        HP DVD 1270i SATA DVD RW
      • Power Supply:
        Corsair 850TX
      • Case:
        Antec 300
      • Cooling:
        Coolermaster V8 / 2x 12CM intake / 1x 12CM rear exhaust / 1x 14CM top exhaust
      • Display:
        Acer 23in 1920x1080 / Acer 20in
      • Operating System:
        Microsoft Windows 8 Professional x64

    Re: VB Project... To help me learn

    That is pretty much it...
    Old_Name_Without_Extension^tArtist_Name^tSongName

    It wouldn't be too hard to change it from tab delimiting to comma delimiting... I am not sure which works best with VB.

    Thanks for the vote of confidence there, but the designer program did much of the work for me! All I had to do is add a few snippets of code...

    I have been reading though and I *think* I am beginning to understand the basics of setting variables, Functions and Subroutines, and (just started looking into) arrays. Too much to take in at once...

    I have to admit... I never learned well from a book... I always did much better by just doing it!!!

    My last little shell app is going to get some added functionality... once I figure out how to do it!

    "Among the tales of sorrow and of ruin that come down to us from the darkness of those days there are yet some in which amid weeping there is joy and under the shadow of death light that endures."

    J.R.R. Tolkien - The Silmarillion

  5. #5
    AceInfinity's Avatar
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,716

    Re: VB Project... To help me learn

    Code:
    My.Computer
    Yikes, shouldn't do that, it's not part of the default .NET libraries and actually only really a Visual Basic reference as My.Computer namespace. Use the System.IO namespace as it has file methods that are just as suitable.

    I have a file directory of karaoke songs (CDG+MP3) and a tab-delimited text file with the file names and the Song Artist/Title. Instead of manually renaming each of the 2000+ files I would like to write a program to do it for me.

    Later on, I would like to add the functionality to compress both the .mp3 & .cdg files into zip containers using the same artist/title filename.
    My advice:

    -Look into the String.Split method
    -Use System.IO instead of My.Computer whenever you can
    -To compress to ZIP, I believe WinRar has this capability, 7zip is command line based as well I think, so you'll either have to utilize these tools, OR go into your own advanced method of compression probably; in which case you're going to want to learn Serialization...
    Last edited by AceInfinity; 06-01-2012 at 11:23 PM.
    \n\n

    Automation Programmer
    Development Site: aceinfinity.net

  6. #6
    GZ's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,923
    • specs System Specs
      • Manufacturer:
        GZ Technologies LLC
      • Model Number:
        Phenom-INAL
      • Motherboard:
        ASUS M5A97-EVO
      • CPU:
        AMD PhenomII x6 (1100T)
      • Memory:
        16GB Kingston Hyper-X blu PC3-12800
      • Graphics:
        XFX Radeon HD6770
      • Sound Card:
        Realtek ALC892
      • Hard Drives:
        500GB WD Caviar Black / 1TB WD Caviar Black / 1TB Seagate / 500GB Hitachi
      • Disk Drives:
        HP DVD 1270i SATA DVD RW
      • Power Supply:
        Corsair 850TX
      • Case:
        Antec 300
      • Cooling:
        Coolermaster V8 / 2x 12CM intake / 1x 12CM rear exhaust / 1x 14CM top exhaust
      • Display:
        Acer 23in 1920x1080 / Acer 20in
      • Operating System:
        Microsoft Windows 8 Professional x64

    Re: VB Project... To help me learn

    Windows can, inherantly, compress to .zip... Why can't I just use it?

    "Among the tales of sorrow and of ruin that come down to us from the darkness of those days there are yet some in which amid weeping there is joy and under the shadow of death light that endures."

    J.R.R. Tolkien - The Silmarillion

  7. #7
    niemiro's Avatar
    Join Date
    Mar 2012
    Location
    District 12
    Posts
    7,827

    Re: VB Project... To help me learn

    Quote Originally Posted by gavinzach View Post
    Windows can, inherantly, compress to .zip... Why can't I just use it?
    I can't quite remember off hand, but it is actually really difficult to access, and requires some nasty hack to go via explorer.exe/the shell, which is really messy. I usually use the Ionic Zip library, which has a nice permissive licence: http://dotnetzip.codeplex.com/

  8. #8
    AceInfinity's Avatar
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,716

    Re: VB Project... To help me learn

    You shouldn't need that either niemiro, I forgot about the Deflate compression libraries for .NET. http://msdn.microsoft.com/en-us/libr...mpression.aspx

    Deflate or Base64 compression is the same standard used in zip archives.
    niemiro says thanks for this.
    \n\n

    Automation Programmer
    Development Site: aceinfinity.net

Similar Threads

  1. Learn New Tricks with Windows (Quick Tip) Guides
    By JMH in forum Windows Tips & Tricks
    Replies: 0
    Last Post: 06-24-2012, 07:28 PM
  2. Replies: 0
    Last Post: 06-24-2012, 04:35 PM
  3. Replies: 0
    Last Post: 06-22-2012, 02:54 AM
  4. Replies: 0
    Last Post: 05-16-2012, 05:00 PM

Log in

Log in