Results 1 to 22 of 22

Thread: bit more help please Access Denied?? "FINALLY RESOLVED" THANKS ALL!!

Hybrid View

  1. #1
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: bit more help please Access Denied??

    Rob,


    here is the code for you to create both the mp3.txt if you need it and audiolist.xml from within vb, no batch file required, the way it is set up at the moment it creates both file in the folder where the mp3s are located, but his is esay to change if you keep you audiolist elsewhere

    VB Code:
    1. Declare Sub Sleep Lib "kernel32.dll" ( _
    2.      ByVal dwMilliseconds As Long)
    goes at the top under Option Expicit

    VB Code:
    1. Private Sub writexml()
    2.  
    3.     Dim f1 As Integer, songpath As String, mp3path As String, f2 As Integer, i As Integer
    4.    
    5.    
    6.     mp3path = "C:\Documents and Settings\User1\My Documents\My Music\MP3\The Greatest Oldies (vol 1)\"
    7.    
    8.      f2 = FreeFile
    9.     Open mp3path & "mp3.txt" For Output As #f2       ' if you don't need mp3.txt take out
    10.      f1 = FreeFile
    11.      
    12.     Open mp3path & "audiolist.xml" For Output As #f1
    13.     Print #f1, "<?xml version=""1.0""?>"
    14.     Print #f1, "<songs>"
    15.     songname = Dir(mp3path & "\*.mp3")   ' get first track
    16.     i = 1
    17.     While Not Len(songname) = 0
    18.         songpath = "<song path=""" & mp3path & songname & """ title=""" & songname & """/> "
    19.         Print #f1, songpath
    20.         Print #f2, songname                  ' for mp3.txt
    21.         Sleep 100                                ' slight pause, needed
    22.         songname = Dir                         ' get next track
    23.    
    24.     Wend
    25.     Print #f1, "</songs>"
    26.  
    27.  
    28. Close
    29. End Sub
    you can put this code into a button click or cal it from a button click

    hope this helps to you to progress in VB

    rgds p.
    Last edited by westconn1; Jan 15th, 2005 at 08:45 AM.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: bit more help please Access Denied??

    thanks but would this automatically add the mp3 files to the xml doc when they have been copied into the my_mp3 folder or will it have to be manually updated by users. The reason I was using the batch was it made it simple for users to add their own tracks without having to manually edit the xml doc therselves.

    eg user browses for a file and that is added to the my_mp3s folder and then ran the batch file and it was ready for playing

    Thanks again for your time
    Rob

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: bit more help please Access Denied??

    this code creates 2 files in the folder where mp3s are located,at present it is a folder on my hard drive, so you will need to change that. or select it from a common dialog setting mp3path to that.

    i didn't know if you needed mp3.txt or if it was just part of your process, it is not required for this code

    this code does not copy any files, it just creates the files with contents as your batch file did.

    if you wanted to copy files you would do that first, then run this code with the path set to where you have copied them to.

    if you just copy this into a new project and put a cmdbutton on the form you can test it quite easily

    p.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: bit more help please Access Denied??

    VB Code:
    1. Option Explicit
    2. Declare Sub Sleep Lib "kernel32.dll" ( _
    3.      ByVal dwMilliseconds As Long)
    4.      
    5. Private Const FAVORITES_FOLDER = "C:\PROGRAM FILES\MGAMERZ\MY_MP3S\"

    I have this in my general declarations but I receive this error -
    compile error:
    constants,Fixed-length strings,arrays,user-defined types and Declare statements not allowed as public members of object modules.

    Any ideas what I've done wrong
    cheers
    Rob

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: bit more help please Access Denied??

    sorry change it to
    VB Code:
    1. Private Declare Sub Sleep Lib "kernel32.dll" ( _
    2.      ByVal dwMilliseconds As Long)

    i had it in a module
    p.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: bit more help please Access Denied??

    I keep getting errors when trying to update the xml. when I click on the update xml button I get this

    Compile error.

    Varialble not defined.

    I have attached my file to see if you can see any blatant errors that I've missed.

    Thanks
    Rob
    Attached Files Attached Files

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: bit more help please Access Denied??

    sorry can't open your file, but the message is specific, one of the variables needs to be dimmed, i just checked my code, all the variable in it were declared,
    did you add any??

    if you want me to check your file attach it in a zip
    p.

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