EJECUCION SATISFACTORIA DE DTS A TRAVÉS DE VB
Publicado por Diana (6 intervenciones) el 09/05/2006 17:01:52
Hola a todos, tengo un problema, el cual es que: a través de un exe de vb, este llama a un .bat que ejecuta un DTS, lo que quiero hacer es que cuando ese DTS se ejecute satisfactoriamente se me mueva un archivo ZIP, TXT O CSV a otra carpeta. Hasta ahora lo he hecho pero resulta que asi me falle alguna tarea del DTS igualmente me mueve el archivo, pero yo no quiero eso, solo lo quiero mover cuando el DTS ejecute todas sus tareas bien.
Este es el codigo de la funcion que uso en visual:
Public Sub ExecCmdNoFocus(ByVal CmdLine As String)
Dim hProcess As Long 'handle del proceso donde se invoca la función Shell
Dim a As Long
Dim codExit As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(CmdLine, 2))
Do
GetExitCodeProcess hProcess, codExit
DoEvents
Loop While codExit = STILL_ACTIVE
''''''''''''''Verifico que el archivo .zip está en la carpeta TXT-ZIP para moverlo a OLD
If file.FileExists(rutaRaiz + "\TXT-ZIP\" + ejecutable + ".zip") Then
file.MoveFile (rutaRaiz & "\TXT-ZIP\" & ejecutable & ".zip"), (rutaRaiz & "\TXT-ZIP\OLD\" & ejecutable & "_" & Day(Date) & " " & Month(Date) & " " & Year(Date) & "_" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s" & ".zip")
End If
''''''''''''''Verifico que el archivo.txt o archivo.csv está en la carpeta ZIP-TXT y se mueve a OLD
If file.FileExists(rutaRaiz + "\ZIP-TXT\" + ejecutable + ".txt") Then
file.MoveFile (rutaRaiz & "\ZIP-TXT\" & ejecutable & ".txt"), (rutaRaiz & "\ZIP-TXT\OLD\" & ejecutable & "_" & Day(Date) & " " & Month(Date) & " " & Year(Date) & "_" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s" & ".txt")
End If
If file.FileExists(rutaRaiz + "\ZIP-TXT\" + ejecutable + ".csv") Then
file.MoveFile (rutaRaiz & "\ZIP-TXT\" & ejecutable & ".csv"), (rutaRaiz & "\ZIP-TXT\OLD\" & ejecutable & "_" & Day(Date) & " " & Month(Date) & " " & Year(Date) & "_" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s" & ".csv")
End If
Este es el codigo de la funcion que uso en visual:
Public Sub ExecCmdNoFocus(ByVal CmdLine As String)
Dim hProcess As Long 'handle del proceso donde se invoca la función Shell
Dim a As Long
Dim codExit As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(CmdLine, 2))
Do
GetExitCodeProcess hProcess, codExit
DoEvents
Loop While codExit = STILL_ACTIVE
''''''''''''''Verifico que el archivo .zip está en la carpeta TXT-ZIP para moverlo a OLD
If file.FileExists(rutaRaiz + "\TXT-ZIP\" + ejecutable + ".zip") Then
file.MoveFile (rutaRaiz & "\TXT-ZIP\" & ejecutable & ".zip"), (rutaRaiz & "\TXT-ZIP\OLD\" & ejecutable & "_" & Day(Date) & " " & Month(Date) & " " & Year(Date) & "_" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s" & ".zip")
End If
''''''''''''''Verifico que el archivo.txt o archivo.csv está en la carpeta ZIP-TXT y se mueve a OLD
If file.FileExists(rutaRaiz + "\ZIP-TXT\" + ejecutable + ".txt") Then
file.MoveFile (rutaRaiz & "\ZIP-TXT\" & ejecutable & ".txt"), (rutaRaiz & "\ZIP-TXT\OLD\" & ejecutable & "_" & Day(Date) & " " & Month(Date) & " " & Year(Date) & "_" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s" & ".txt")
End If
If file.FileExists(rutaRaiz + "\ZIP-TXT\" + ejecutable + ".csv") Then
file.MoveFile (rutaRaiz & "\ZIP-TXT\" & ejecutable & ".csv"), (rutaRaiz & "\ZIP-TXT\OLD\" & ejecutable & "_" & Day(Date) & " " & Month(Date) & " " & Year(Date) & "_" & Hour(Time) & "h" & Minute(Time) & "m" & Second(Time) & "s" & ".csv")
End If
Valora esta pregunta


0