Changeset: 574 fdbozzo - 21/12/2014 02:01:03:

- Arreglo del manejo de errores en los scripts vbs y mejora de localización de mensajes
This commit is contained in:
fdbozzo
2014-12-21 03:02:13 +01:00
parent 86a0f1032f
commit f737c1473e
4 changed files with 32 additions and 37 deletions

View File

@@ -13,7 +13,7 @@
' - Ahora puede seleccionar archivos o directorios, pulsar click derecho y "Enviar a" FoxBin2prg para conversiones batch
'---------------------------------------------------------------------------------------------------
Const ForReading = 1
Dim WSHShell, FileSystemObject, cEndOfProcessMsg, cWithErrorsMsg, cConvCancelByUserMsg
Dim WSHShell, FileSystemObject, cEndOfProcessMsg, cWithErrorsMsg, cConvCancelByUserMsg, nProcessedFilesCount
Dim oVFP9, nExitCode, cEXETool, cCMD, nDebug, lcExt, foxbin2prg_cfg, aFiles(), nFile_Count
Dim i, x, str_cfg, aConf, cErrMsg, cFlagGenerateLog, cFlagDontShowErrMsg, cFlagJustShowCall, cFlagRecompile, cFlagNoTimestamps, cErrFile
Set WSHShell = WScript.CreateObject("WScript.Shell")
@@ -93,7 +93,7 @@ Else
If nDebug = 0 Or nDebug = 2 Then
cCMD = "oFoxBin2prg.ejecutar( '" & aFiles(i) & "' )"
Else
cCMD = "oFoxBin2prg.ejecutar( '" & aFiles(i) & "','0','0','0'," _
cCMD = "oFoxBin2prg.ejecutar( '" & aFiles(i) & "','BIN2PRG','0','0'," _
& cFlagDontShowErrMsg & "," & cFlagGenerateLog & ",'1','','',.F.,''," _
& cFlagRecompile & "," & cFlagNoTimestamps & " )"
End If
@@ -101,8 +101,7 @@ Else
If cFlagJustShowCall = "1" Then
MsgBox cCMD, 64, "PARAMETERS"
Else
oVFP9.DoCmd( cCMD )
nExitCode = oVFP9.Eval("_SCREEN.ExitCode")
nExitCode = oVFP9.Eval(cCMD)
End If
If nExitCode = 1799 Then 'Conversion cancelled by user
@@ -114,20 +113,21 @@ Else
cEndOfProcessMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_END_OF_PROCESS_LOC")
cWithErrorsMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_WITH_ERRORS_LOC")
cConvCancelByUserMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_CONVERSION_CANCELLED_BY_USER_LOC")
nProcessedFilesCount = oVFP9.Eval("oFoxBin2prg.n_ProcessedFilesCount")
If nExitCode = 1799 Then
MsgBox cConvCancelByUserMsg & "!", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cConvCancelByUserMsg & "! [p:" & nProcessedFilesCount & "]", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
oVFP9.DoCmd("oFoxBin2prg.writeErrorLog_Flush()")
cErrFile = oVFP9.Eval("oFoxBin2prg.c_ErrorLogFile")
WSHShell.run cErrFile
ElseIf oVFP9.Eval("oFoxBin2prg.l_Error") Then
MsgBox cEndOfProcessMsg & "! (" & cWithErrorsMsg & ")", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cEndOfProcessMsg & "! (" & cWithErrorsMsg & ") [p:" & nProcessedFilesCount & "]", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
oVFP9.DoCmd("oFoxBin2prg.writeErrorLog_Flush()")
cErrFile = oVFP9.Eval("oFoxBin2prg.c_ErrorLogFile")
WSHShell.run cErrFile
Else
MsgBox cEndOfProcessMsg & "!", 64+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cEndOfProcessMsg & "! [p:" & nProcessedFilesCount & "]", 64+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
End If
End If
@@ -159,18 +159,17 @@ End Sub
Private Sub evaluateFile( tcFile )
lcExt = UCase( FileSystemObject.GetExtensionName( tcFile ) )
oVFP9.SetVar "gc_Ext", lcExt
oVFP9.DoCmd( "oFoxBin2prg.EvaluarConfiguracion( '1', '1', '', '', '', '', '', '', '" & tcFile & "' )" )
'lcExt = UCase( FileSystemObject.GetExtensionName( tcFile ) )
'oVFP9.DoCmd( "oFoxBin2prg.EvaluarConfiguracion( '1', '1', '', '', '', '', '', '', '" & tcFile & "' )" )
'PROCEDURE EvaluarConfiguracion
' LPARAMETERS tcDontShowProgress, tcDontShowErrors, tcFlagNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels ;
' , tcClearUniqueID, tcOptimizeByFilestamp, tc_InputFile
If oVFP9.Eval("oFoxBin2prg.TieneSoporte_Bin2Prg(gc_Ext)") Then
'If oVFP9.Eval("oFoxBin2prg.TieneSoporte_Bin2Prg('" & lcExt & "')") Then
nFile_Count = nFile_Count + 1
ReDim Preserve aFiles(nFile_Count)
aFiles(nFile_Count) = tcFile
End If
'End If
End Sub

View File

@@ -13,7 +13,7 @@
' - Ahora puede seleccionar archivos o directorios, pulsar click derecho y "Enviar a" FoxBin2prg para conversiones batch
'---------------------------------------------------------------------------------------------------
Const ForReading = 1
Dim WSHShell, FileSystemObject, cEndOfProcessMsg, cWithErrorsMsg, cConvCancelByUserMsg
Dim WSHShell, FileSystemObject, cEndOfProcessMsg, cWithErrorsMsg, cConvCancelByUserMsg, nProcessedFilesCount
Dim oVFP9, nExitCode, cEXETool, cCMD, nDebug, lcExt, foxbin2prg_cfg, aFiles(), nFile_Count
Dim i, x, str_cfg, aConf, cErrMsg, cFlagGenerateLog, cFlagDontShowErrMsg, cFlagJustShowCall, cFlagRecompile, cFlagNoTimestamps, cErrFile
Set WSHShell = WScript.CreateObject("WScript.Shell")
@@ -99,7 +99,7 @@ Else
If nDebug = 0 Or nDebug = 2 Then
cCMD = "oFoxBin2prg.ejecutar( '" & aFiles(i) & "' )"
Else
cCMD = "oFoxBin2prg.ejecutar( '" & aFiles(i) & "','0','0','0'," _
cCMD = "oFoxBin2prg.ejecutar( '" & aFiles(i) & "','PRG2BIN','0','0'," _
& cFlagDontShowErrMsg & "," & cFlagGenerateLog & ",'1','','',.F.,''," _
& cFlagRecompile & "," & cFlagNoTimestamps & " )"
End If
@@ -107,8 +107,7 @@ Else
If cFlagJustShowCall = "1" Then
MsgBox cCMD, 64, "PARAMETERS"
Else
oVFP9.DoCmd( cCMD )
nExitCode = oVFP9.Eval("_SCREEN.ExitCode")
nExitCode = oVFP9.Eval(cCMD)
End If
If nExitCode = 1799 Then 'Conversion cancelled by user
@@ -120,20 +119,21 @@ Else
cEndOfProcessMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_END_OF_PROCESS_LOC")
cWithErrorsMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_WITH_ERRORS_LOC")
cConvCancelByUserMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_CONVERSION_CANCELLED_BY_USER_LOC")
nProcessedFilesCount = oVFP9.Eval("oFoxBin2prg.n_ProcessedFilesCount")
If nExitCode = 1799 Then
MsgBox cConvCancelByUserMsg & "!", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cConvCancelByUserMsg & "! [p:" & nProcessedFilesCount & "]", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
oVFP9.DoCmd("oFoxBin2prg.writeErrorLog_Flush()")
cErrFile = oVFP9.Eval("oFoxBin2prg.c_ErrorLogFile")
WSHShell.run cErrFile
ElseIf oVFP9.Eval("oFoxBin2prg.l_Error") Then
MsgBox cEndOfProcessMsg & "! (" & cWithErrorsMsg & ")", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cEndOfProcessMsg & "! (" & cWithErrorsMsg & ") [p:" & nProcessedFilesCount & "]", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
oVFP9.DoCmd("oFoxBin2prg.writeErrorLog_Flush()")
cErrFile = oVFP9.Eval("oFoxBin2prg.c_ErrorLogFile")
WSHShell.run cErrFile
Else
MsgBox cEndOfProcessMsg & "!", 64+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cEndOfProcessMsg & "! [p:" & nProcessedFilesCount & "]", 64+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
End If
End If
@@ -165,24 +165,22 @@ End Sub
Private Sub evaluateFile( tcFile )
lcExt = UCase( FileSystemObject.GetExtensionName( tcFile ) )
lcFileName = FileSystemObject.GetFileName( tcFile )
laPoints = Split( lcFileName, "." )
lnPoints = UBound(laPoints)
'lcExt = UCase( FileSystemObject.GetExtensionName( tcFile ) )
'lcFileName = FileSystemObject.GetFileName( tcFile )
'laPoints = Split( lcFileName, "." )
'lnPoints = UBound(laPoints)
'-- No proceso los archivos con m<>s de un punto (clases en archivos individuales) por performance
If lnPoints = 1 Then
oVFP9.SetVar "gc_Ext", lcExt
'If lnPoints = 1 Then
'PROCEDURE EvaluarConfiguracion
' LPARAMETERS tcDontShowProgress, tcDontShowErrors, tcFlagNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels ;
' , tcClearUniqueID, tcOptimizeByFilestamp, tc_InputFile
oVFP9.DoCmd( "oFoxBin2prg.EvaluarConfiguracion( '1', '1', '', '', '', '', '', '', '" & tcFile & "' )" )
If oVFP9.Eval("oFoxBin2prg.TieneSoporte_Prg2Bin(gc_Ext)") Then
'oVFP9.DoCmd( "oFoxBin2prg.EvaluarConfiguracion( '1', '1', '', '', '', '', '', '', '" & tcFile & "' )" )
'If oVFP9.Eval("oFoxBin2prg.TieneSoporte_Prg2Bin('" & lcExt & "')") Then
nFile_Count = nFile_Count + 1
ReDim Preserve aFiles(nFile_Count)
aFiles(nFile_Count) = tcFile
End If
End If
'End If
'End If
End Sub

View File

@@ -13,7 +13,7 @@
' en la carpeta "SendTo" del usuario
' - Ahora puede seleccionar archivos o directorios, pulsar click derecho y "Enviar a" FoxBin2prg para conversiones batch
'---------------------------------------------------------------------------------------------------
Dim WSHShell, FileSystemObject, cEndOfProcessMsg, cWithErrorsMsg, cConvCancelByUserMsg
Dim WSHShell, FileSystemObject, cEndOfProcessMsg, cWithErrorsMsg, cConvCancelByUserMsg, nProcessedFilesCount
Dim nExitCode, cEXETool, cEXETool2, nDebug
Set wshShell = CreateObject( "WScript.Shell" )
Set FileSystemObject = WScript.CreateObject("Scripting.FileSystemObject")
@@ -104,20 +104,21 @@ Else
cEndOfProcessMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_END_OF_PROCESS_LOC")
cWithErrorsMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_WITH_ERRORS_LOC")
cConvCancelByUserMsg = oVFP9.Eval("_SCREEN.o_FoxBin2Prg_Lang.C_CONVERSION_CANCELLED_BY_USER_LOC")
nProcessedFilesCount = oVFP9.Eval("oFoxBin2prg.n_ProcessedFilesCount")
If nExitCode = 1799 Then
MsgBox cConvCancelByUserMsg & "!", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cConvCancelByUserMsg & "! [p:" & nProcessedFilesCount & "]", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
oVFP9.DoCmd("oFoxBin2prg.writeErrorLog_Flush()")
cErrFile = oVFP9.Eval("oFoxBin2prg.c_ErrorLogFile")
WSHShell.run cErrFile
ElseIf oVFP9.Eval("oFoxBin2prg.l_Error") Then
MsgBox cEndOfProcessMsg & "! (" & cWithErrorsMsg & ")", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cEndOfProcessMsg & "! (" & cWithErrorsMsg & ") [p:" & nProcessedFilesCount & "]", 48+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
oVFP9.DoCmd("oFoxBin2prg.writeErrorLog_Flush()")
cErrFile = oVFP9.Eval("oFoxBin2prg.c_ErrorLogFile")
WSHShell.run cErrFile
Else
MsgBox cEndOfProcessMsg & "!", 64+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
MsgBox cEndOfProcessMsg & "! [p:" & nProcessedFilesCount & "]", 64+4096, WScript.ScriptName & " (" & oVFP9.Eval("oFoxBin2prg.c_FB2PRG_EXE_Version") & ")"
End If
End If

View File

@@ -2354,9 +2354,6 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM
ENDCASE
*CASE THIS.l_Debug
* THIS.writeErrorLog_Flush( )
ENDCASE
STORE NULL TO loFSO, loWSH