hi thanks for your reply i am trying to run and execute the following active x script through a scheduled task. I changed the code a little bit, i want to just add the current date in some files. Like i said when i execute this through a ssis package it adds the date to the files but when i run it by schedule tasks eventhough i get no errors no dates are added.
'************************************************* ***********
' Visual Basic ActiveX Script
'************************************************* ***********
Function Main()
Dt = now()
y = Right(Year(Dt),2)
m = Month(Dt)
d = Day(Dt)
If Len(m) = 1 Then
m = "0" & m
End If
If Len(d) = 1 Then
d = "0" & d
End If
Filename= m & d & y & ".txt"
SFile ="C:\archive\"
DFile ="C:\archive\"
SFile1 = SFile &"UtilityDB_log_"& Filename
SFile2 = SFile &"Distributor_log_"& Filename
DFile1 =DFile & "UtilityDB_log.txt"
DFile2 =DFile & "Distributor_log.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
If (FSO.FileExists(DFile1)) Then
Set NewFile = FSO.GetFile(DFile1)
NewFile.Copy(SFile1)
FSO.DeleteFile(DFile1)
End If
If (FSO.FileExists(DFile2)) Then
Set NewFile = FSO.GetFile(DFile2)
NewFile.Copy (SFile2)
FSO.DeleteFile(DFile2)
End If
Set FSO = Nothing
Main = DTSTaskExecResult_Success
End Function
