diff --git a/Convert_VFP9_BIN_2_PRG.vbs b/Convert_VFP9_BIN_2_PRG.vbs index ecd0fe8..8a6bebf 100644 --- a/Convert_VFP9_BIN_2_PRG.vbs +++ b/Convert_VFP9_BIN_2_PRG.vbs @@ -60,6 +60,7 @@ Else oVFP9.DoCmd( "PUBLIC oFoxBin2prg" ) oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" ) oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" ) + oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress" ) For i = 0 To WScript.Arguments.Count-1 scanDirs( WScript.Arguments(i) ) @@ -83,6 +84,8 @@ Else cFlagNoTimestamps = "'1'" End If + oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress + ' (Press Esc to Cancel)'" ) + For i = 1 To nFile_Count oVFP9.DoCmd( "oFoxBin2Prg.AvanceDelProceso(oFoxBin2Prg.c_loc_processing_file + ' " & aFiles(i) & "...', " & i & ", " & nFile_Count & ", 0)" ) cFlagRecompile = "'" & FileSystemObject.GetParentFolderName( aFiles(i) ) & "'" diff --git a/Convert_VFP9_PRG_2_BIN.vbs b/Convert_VFP9_PRG_2_BIN.vbs index 1b7d8bd..1790852 100644 --- a/Convert_VFP9_PRG_2_BIN.vbs +++ b/Convert_VFP9_PRG_2_BIN.vbs @@ -60,6 +60,7 @@ Else oVFP9.DoCmd( "PUBLIC oFoxBin2prg" ) oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" ) oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" ) + oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress" ) For i = 0 To WScript.Arguments.Count-1 scanDirs( WScript.Arguments(i) ) @@ -89,6 +90,8 @@ Else cFlagNoTimestamps = "'1'" End If + oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress + ' (Press Esc to Cancel)'" ) + For i = 1 To nFile_Count oVFP9.DoCmd( "oFoxBin2Prg.AvanceDelProceso(oFoxBin2Prg.c_loc_processing_file + ' " & aFiles(i) & "...', " & i & ", " & nFile_Count & ", 0)" ) cFlagRecompile = "'" & FileSystemObject.GetParentFolderName( aFiles(i) ) & "'" diff --git a/VFP9_FoxBin2Prg.vbs b/VFP9_FoxBin2Prg.vbs index 73899ab..5ef8430 100644 --- a/VFP9_FoxBin2Prg.vbs +++ b/VFP9_FoxBin2Prg.vbs @@ -62,6 +62,7 @@ Else oVFP9.DoCmd( "PUBLIC oFoxBin2prg" ) oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" ) oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" ) + oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress" ) cFlagGenerateLog = "'0'" cFlagDontShowErrMsg = "'0'" @@ -83,6 +84,8 @@ Else cFlagRecompile = "'" & FileSystemObject.GetParentFolderName( WScript.Arguments(0) ) & "'" + oVFP9.DoCmd( "oFoxBin2prg.o_frm_avance.Caption = '" & FileSystemObject.GetBaseName( WScript.ScriptName ) & " - ' + oFoxBin2Prg.c_loc_process_progress + ' (Press Esc to Cancel)'" ) + If nDebug = 0 Or nDebug = 2 Then cCMD = "oFoxBin2prg.ejecutar( '" & WScript.Arguments(0) & "' )" Else @@ -98,7 +101,14 @@ Else End If If GetBit(nDebug, 4) Then - If oVFP9.Eval("oFoxBin2prg.l_Error") Then + 'If oVFP9.Eval("oFoxBin2prg.l_Error") Then + If nExitCode = 1799 Then + MsgBox "Conversion Cancelled by User!", 48, WScript.ScriptName + cErrFile = oVFP9.Eval("FORCEPATH('FoxBin2Prg.LOG',GETENV('TEMP') )") + oVFP9.DoCmd("STRTOFILE( oFoxBin2prg.c_ErrorLog, '" & cErrFile & "' )") + WSHShell.run cErrFile + + ElseIf nExitCode > 0 Then MsgBox "End of Process! (with errors)", 48, WScript.ScriptName cErrFile = oVFP9.Eval("FORCEPATH('FoxBin2Prg.LOG',GETENV('TEMP') )") oVFP9.DoCmd("STRTOFILE( oFoxBin2prg.c_ErrorLog, '" & cErrFile & "' )") diff --git a/foxbin2prg.exe b/foxbin2prg.exe index 5e7e9b5..bc0aabe 100644 Binary files a/foxbin2prg.exe and b/foxbin2prg.exe differ diff --git a/foxbin2prg.prg b/foxbin2prg.prg index 5922edd..93ae46f 100644 --- a/foxbin2prg.prg +++ b/foxbin2prg.prg @@ -592,6 +592,7 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM n_FB2PRG_Version = 1.19 *-- Localized properties c_loc_processing_file = C_PROCESSING_LOC + c_loc_process_progress = C_PROCESS_PROGRESS_LOC *-- c_Language = 'ES' c_FB2PRG_EXE_Version = 0 @@ -710,7 +711,6 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM FINALLY ON ESCAPE - THIS.o_Frm_Avance = NULL THIS.o_FSO = NULL THIS.o_FNC = NULL ENDTRY @@ -722,10 +722,19 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM PROCEDURE AvanceDelProceso LPARAMETERS tcTexto, tnValor, tnTotal, tnTipo - *-- Si o_Frm_Avance se habilitó de forma externa, l_ShowProgress podría ser .F. para controlarlo desde fuera. - IF VARTYPE(THIS.o_Frm_Avance) = "O" THEN - THIS.o_Frm_Avance.AvanceDelProceso( tcTexto, tnValor, tnTotal, tnTipo ) - ENDIF + TRY + *-- Si o_Frm_Avance se habilitó de forma externa, l_ShowProgress podría ser .F. para controlarlo desde fuera. + IF VARTYPE(THIS.o_Frm_Avance) = "O" THEN + *-- Cuando esta rutina se invoca desde el script, este método es el #1 y no puede cancelarse todavía + IF THIS.o_Frm_Avance.l_Cancelled AND PROGRAM(-1) > 1 THEN + ERROR 1799 + ENDIF + THIS.o_Frm_Avance.AvanceDelProceso( tcTexto, tnValor, tnTotal, tnTipo ) + ENDIF + + CATCH + THROW + ENDTRY ENDPROC @@ -2670,19 +2679,20 @@ ENDDEFINE ******************************************************************************************************************* DEFINE CLASS frm_avance AS FORM - Height = 100 + Height = 110 Width = 628 ShowWindow = 2 DoCreate = .T. AutoCenter = .T. BorderStyle = 2 - CAPTION = C_PROCESS_PROGRESS_LOC + ' (Press Esc to Cancel)' + CAPTION = 'FoxBin2Prg - ' + C_PROCESS_PROGRESS_LOC + ' (Press Esc to Cancel)' ControlBox = .F. BackColor = RGB(255,255,255) nmax_value = 100 nmax_value2 = 100 nvalue = 0 nvalue2 = 0 + l_Cancelled = .F. Name = "frm_avance" _memberdata = [] ; + [] ; @@ -2694,11 +2704,12 @@ DEFINE CLASS frm_avance AS FORM + [] ; + [] ; + [] ; + + [] ; + [] ADD OBJECT shp_base AS shape WITH ; - Top = 32, ; + Top = 28, ; Left = 12, ; Height = 13, ; Width = 604, ; @@ -2707,7 +2718,7 @@ DEFINE CLASS frm_avance AS FORM ADD OBJECT shp_avance AS shape WITH ; - Top = 32, ; + Top = 28, ; Left = 12, ; Height = 13, ; Width = 36, ; @@ -2722,13 +2733,13 @@ DEFINE CLASS frm_avance AS FORM Caption = ".", ; Height = 17, ; Left = 12, ; - Top = 12, ; + Top = 8, ; Width = 604, ; Name = "lbl_Tarea" ADD OBJECT shp_base2 AS shape WITH ; - Top = 68, ; + Top = 64, ; Left = 12, ; Height = 13, ; Width = 604, ; @@ -2737,7 +2748,7 @@ DEFINE CLASS frm_avance AS FORM ADD OBJECT shp_avance2 AS shape WITH ; - Top = 68, ; + Top = 64, ; Left = 12, ; Height = 13, ; Width = 36, ; @@ -2752,15 +2763,33 @@ DEFINE CLASS frm_avance AS FORM Caption = ".", ; Height = 17, ; Left = 12, ; - Top = 48, ; + Top = 44, ; Width = 604, ; Name = "lbl_Tarea2" + ADD OBJECT cmdcancel AS commandbutton WITH ; + Top = 84, ; + Left = 252, ; + Height = 21, ; + Width = 100, ; + Caption = "Cancel", ; + Enabled = .F., ; + Name = "cmdCancel" + + PROCEDURE AvanceDelProceso LPARAMETERS tcTexto, tnValor, tnTotal, tnTipo WITH THIS AS frm_avance OF foxbin2prg.prg + *-- Habilita el botón de cancelar una vez que se comienzan a pasar valores + IF NOT EMPTY(tnValor) THEN + IF NOT .cmdCancel.Enabled THEN + .cmdCancel.Enabled = .T. + ENDIF + DOEVENTS + ENDIF + DO CASE CASE tnTipo = 0 IF NOT EMPTY(tcTexto) THEN @@ -2825,6 +2854,11 @@ DEFINE CLASS frm_avance AS FORM ENDPROC + PROCEDURE cmdcancel.Click + THISFORM.l_Cancelled = .T. + ENDPROC + + ENDDEFINE