; FUNCIONES BASE v1.0 ; Funciones comunes utilizadas en la mayoría de scripts ; INCLUDES MINIMOS ;#include ;#include ;#include ;#include ;#include ; ======================================================== Func MensajeAviso($sTexto) ; Muestra un mensaje. Si se pulsa cancelar, se cierra el script Local $iOpcion $iOpcion = MsgBox($MB_OKCANCEL, "DEBUG", $sTexto) If $iOpcion = $IDCANCEL Then Exit Else Return EndIf EndFunc Func MensajeAvisoTemporal($sTexto) Local $iOpcion $iOpcion = MsgBox($MB_OKCANCEL, "DEBUG", $sTexto, $iTiempoMensaje) EndFunc Func GetFecha() Return @YEAR & "-" & @MON & "-" & @MDAY EndFunc Func GetHora() Return @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC EndFunc Func AbrirFicheroLogs() If Not FileExists($sRutaLogs) Then DirCreate($sRutaLogs) EndIf $hFicheroLogs = FileOpen($sFicheroLogs, $FO_APPEND) If $hFicheroLogs = -1 Then MensajeAviso("Error al abrir el fichero de logs") Exit EndIf Return $hFicheroLogs EndFunc Func LogInfo($sTexto) $sTexto = "INFO " & GetFecha() & " " & GetHora() & " | " & $sTexto FileWriteLine($hFicheroLogs, $sTexto) EndFunc Func LogError($sTexto) $sTexto = "ERROR " & GetFecha() & " " & GetHora() & " | " & $sTexto MensajeAvisoTemporal($sTexto) FileWriteLine($hFicheroLogs, $sTexto) FileClose($hFicheroLogs) Exit EndFunc Func LogDebug($sTexto) $sTexto = "DEBUG " & GetFecha() & " " & GetHora() & " | " & $sTexto FileWriteLine($hFicheroLogs, $sTexto) EndFunc Func PausaUsuario() Sleep($iTiempoMedio) EndFunc Func Finalizar() LogError("PROCESO FINALIZADO SIN TERMINAR") Exit 0 EndFunc