
Create a new .wav file from an existing .wav file based on the date
Here is a way to parse the date to get the parts of the date ...
aDate = Split(_
Replace(_
FormatDateTime(Date, vbLongDate), _
" ", ","), _
",")
sDayName = aDate(0)
sMonthName = aDate(2)
sDayNumb = aDate(3)
sYear = aDate(5)
Then assuming the files with the proper names exist in the target
folder, the FSO CopyFile method should do the trick, something like
this ...
' <CAUTION><AIRCODE>
sPathSpec = "D:\Somplace\or\Other\"
sCurrentMonth = "E:\Wherever\CurrentDay.wav"
sCurrentMonth = "E:\Wherever\CurrentMonth.wav"
with CreateObject("Scripting.FileSystemObject")
if exist .FileExists(sPathspec & sDayName & ".wav") Then _
.CopyFile sPathspec & sDayName & ".wav", CurrentDay
if exist .FileExists(sPathspec & sMonthName & ".wav") Then _
.CopyFile sPathspec & sMonthName & ".wav", CurrentMonth
if exist .FileExists(sPathspec & sDayNumb & ".wav") Then _
.CopyFile sPathspec & sDayNumb & ".wav", CurrentDayNumber
End With
' </AIRCODE></CAUTION>
Not the most efficient, but I hope you get the idea.
Tom Lavedas
===========
Quote:
> I'm trying to write a small script that will allow me to create a new wav
> file by copying/renaming an existing wav file based on the date.
> Basically, I have several wav files recorded each saying a specific portion
> of a date. For instance, monday.wav simply says "Monday". april.wav says
> "April", and so on.
> So, based on the computer's date, I want to use these existing wav files to
> create 3 new wav files: CurrentDay.wav, CurrentMonth.wav, and
> CurrentNumber.wav.
> I could then put them into a subroutine I already have that will "speak the
> date" correctly all the time... "Today is Monday, February 10th".
> It seems like a simple procedure, but I just can't figure it out. Any input
> would be greatly appreciated,
> Bob Brislin