PDA

View Full Version : automation whith vbs



13841384
05-11-2006, 04:52 AM
I would like to convert all the files contained in a repertory towards another repertory with a file vbs.
I manage to convert one; but how I can say select all the files of the repertory with "dMC.AddFromFile" ?

LtData
05-11-2006, 09:56 PM
Moved to the Developer section of the forum.
Also, see here: http://www.dbpoweramp.com/developer-scripting-dmc.htm

donny
05-14-2006, 07:03 AM
why don't you just iterate trhu the list and convert one by one? with a for command or something like that... (i'm not really a vb man but it should be easy to do..)

13841384
05-15-2006, 03:39 AM
why don't you just iterate trhu the list and convert one by one? with a for command or something like that... (i'm not really a vb man but it should be easy to do..)
By what I want to convert a series of file wav into mp3, and that the name and the number of file vary.
With the fact, which I want is:
I have a repertory or are copied files wav automaticly, and I would like, automaticly convert these files towards another repertory.
The file vbs that I have fact can convert a precise file towards this repertory; the problem, I do not manage to make this file vbs so that it select all the files of the repertory, and then which convert them towards a repertory.
Like dMC can manually convert many files selected, I wondered how to do it make automaticly.
Here current file VBS:


' Create dMC Object
Set dMC = CreateObject("dMCScripting.Converter")

' Set My options (Volume norm on, ID Tag Preservation On, No delete Source files)
dMC.VolumeNormalize = True
dMC.PreserveTags = True
dMC.DeleteSourceFiles = False

' Set Output Folder (to D:\CONVERTED)
dMC.ConvertToFolder = True
dMC.ToFolder = "D:\CONVERTED"

' Add My Files to Convert
Call dMC.AddFromFile("D:\TOCONVERT\test.wav")

' Convert To Wave (No option page, Want Overwrite page, Want finished, Want Errors)
Call dMC.GoConversion("Mp3 (Blade)", True, True, True, False)


How to modify the line:


Call dMC.AddFromFile("D:\TOCONVERT\test.wav")

So that the vbs takes all the files of the repertory ?

Thank for a answer !

Deano
05-15-2006, 07:03 AM
Do some research into Microsoft's built-in file scripting object. You can call it via:


Set fSO = CreateObject("Scripting.FileSystemObject")
You should be able to use this to open folders and iterate through its entire contents, then you should be able to dynamically insert the filename into the correct place in your script.

Take a look here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/8b99eead-e2bd-45c6-9660-bbbfeec192f0.asp)

13841384
05-15-2006, 09:27 AM
Do some research into Microsoft's built-in file scripting object. You can call it via:


Set fSO = CreateObject("Scripting.FileSystemObject")
You should be able to use this to open folders and iterate through its entire contents, then you should be able to dynamically insert the filename into the correct place in your script.

Take a look here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/8b99eead-e2bd-45c6-9660-bbbfeec192f0.asp)

Thanks for answer, it's good for select, but Call dMC.AddFromToFiles(VAR) or
Call dMC.AddFromFile(VAR) don't convert the list ! A idea ?

13841384
05-15-2006, 10:21 AM
I have the solution !



' Create dMC Object
Set dMC = CreateObject("dMCScripting.Converter")

' Set My options (Volume norm on, ID Tag Preservation On, No delete Source files)
dMC.VolumeNormalize = True
dMC.PreserveTags = True
dMC.DeleteSourceFiles = False

' Set Output Folder (to D:\AUDIOTEMP\CONVERTED )
dMC.ConvertToFolder = True
dMC.ToFolder = "D:\AUDIOTEMP\CONVERTED"

Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("D:\AUDIOTEMP")
Set fc = f.Files
For Each f1 in fc
s = "D:\AUDIOTEMP\" & f1.name
MsgBox ("s is: " & s)
Call dMC.AddFromFile(s)
' Add My Files to Convert
'Call dMC.AddFromFile(s)

' Convert To Wave (No option page, Want Overwrite page, Want finished, Want Errors)
Call dMC.GoConversion("Mp3 (Blade)", True, True, True, False)

Next


Thank all :smile2:

donny
05-15-2006, 11:12 AM
nice...

it's always good to have pieces of code for examples around the forum :D