DEMIAN_ABRAXAS

Cronometro

Apr 7th, 2019
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. Rem Segaforfelix, DEMIAN_ABRAXAS
  3. title Cronometro
  4. set Carpet="%USERPROFILE%\Desktop\Practica_I\Registro.txt"
  5. IF NOT exist %Carpet% (
  6. md %Carpet:~0,-14%"
  7. echo REGISTRO:> %Carpet%
  8. echo.>> %Carpet%
  9. )
  10.  
  11. set /a nh=0
  12. set /a nm=0
  13. set /a nr=0
  14. for /f "usebackq eol=H tokens=2" %%a in (%Carpet%) do (
  15. set /a nh=%%a+nh
  16. )
  17. for /f "usebackq eol=H tokens=4" %%a in (%Carpet%) do (
  18. set /a nm=%%a+nm
  19. )
  20. IF %nm% GEQ 60 (
  21. set /a nr=1
  22. )
  23. IF "%nr%"=="1" (
  24. set /a nh=nh+nm/60
  25. set /a nm=nm%%60
  26. )
  27.  
  28. echo Progreso Total: %nh% horas. %nm% minutos.
  29. echo.
  30. set /p a="Presione enter para iniciar el conteo...."
  31. set a=%time%
  32. set b=%date%
  33. echo.
  34. set /p c="Presione enter para finalizar el conteo...."
  35. set c=%time%
  36.  
  37. IF "%a:~0,1%" EQU "0" (set /a hi=%a:~1,1%) ELSE (set /a hi=%a:~0,2%)
  38. IF "%a:~3,1%" EQU "0" (set /a mi=%a:~4,1%) ELSE (set /a mi=%a:~3,2%)
  39.  
  40. IF "%c:~0,1%" EQU "0" (set /a hf=%c:~1,1%) ELSE (set /a hf=%c:~0,2%)
  41. IF "%c:~3,1%" EQU "0" (set /a mf=%c:~4,1%) ELSE (set /a mf=%c:~3,2%)
  42.  
  43. set /a Resulm=mf-mi
  44. set /a Resulh=hf-hi
  45.  
  46. IF %hi% GTR %hf% (
  47. Set /a Resulh=24+Resulh
  48. )
  49.  
  50. IF %mi% GTR %mf% (
  51. Set /A Resulh=Resulh-1
  52. Set /A Resulm=60+Resulm)
  53.  
  54. echo.
  55. Echo La practica a durado:
  56. Echo %Resulh% horas.
  57. Echo %Resulm% minutos.
  58. echo.
  59.  
  60. :save
  61. set /p g="¿Desea guardarlo en el Registro?(s/n)"
  62. echo.
  63. IF "%g%"=="n" (exit) ELSE (
  64. IF "%g%"=="s" (
  65. echo %b%>>%Carpet%
  66. echo Hora inicial: %a%>>%Carpet%
  67. echo Hora final: %c%>>%Carpet%
  68. echo Duración: %Resulh% horas. %Resulm% minutos.>>%Carpet%
  69. echo.>> %Carpet%
  70. ) ELSE (goto save)
  71. )
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×