Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.67 KB | None | 0 0
  1. @echo off
  2.  
  3. setlocal enabledelayedexpansion
  4.  
  5. if not exist DailyTasks (
  6. md DailyTasks
  7. attrib +h DailyTasks
  8. echo "%cd%\ToDoList.bat">"%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Startup.bat"
  9. )
  10.  
  11. :menu
  12. mode con cols=80 lines=20
  13. title ToDoList
  14.  
  15. cls
  16. echo ToDoList.bat
  17. echo (c)2017 Romain Dieu--Guillot
  18. echo For more information, please go to raiseit.shost.ca
  19. echo --------------------------------------------------------------------------------
  20. echo What do you want to do today ^?
  21. echo write done when finished or leave blank to leave
  22.  
  23. set "nb=0"
  24.  
  25. :ask
  26. set "input="
  27. set /p "input=>"
  28. set /a nb+=1
  29. set "task%nb%=%input%"
  30. if "%input%"=="" goto end
  31. if "%input%"=="done" goto list
  32. if "%input%"=="export" goto export
  33. goto ask
  34.  
  35. :list
  36.  
  37.  
  38. echo;!nb!
  39. for /l %%A in (1,1,%nb%) do (
  40. call :lenght "!task%%A!"
  41. cls
  42. echo.
  43. echo   Tache %%A: %cols% %length% !$cols!
  44. echo   !task%%A!
  45. pause>nul
  46. )
  47. set /a nb-=1
  48.  
  49. cls
  50. echo Congratulation
  51. echo You completed all today's task.
  52. pause>nul
  53. goto menu
  54.  
  55. :export
  56. set /a nb-=1
  57. for /l %%A in (1,1,%nb%) do (
  58. (echo Tache %%A:
  59. echo !task%%A!
  60. echo.)>>ToDoList.txt
  61. )
  62.  
  63. cls
  64. echo Task list exported
  65. pause>nul
  66. goto menu
  67.  
  68.  
  69.  
  70. :end
  71. exit
  72.  
  73.  
  74. :length
  75. for /f "tokens=1* delims=[]" %%l in ('
  76.   "%comspec% /u /c echo:%~1|more|find /n /v """
  77.  ') do set /a "cols=%%l"
  78. call :SizeCmdWindow "%cols%" "20" 1
  79. goto :eof
  80.  
  81.  
  82.  
  83.  
  84. :SizeCmdWindow <cols> <lines> <MODE>
  85. set "$cols=%~1"
  86. set "$lines=%~2"
  87. if "%~3"=="" echo;MODE is undefined&pause&goto :eof
  88. if "%~3"=="0" (
  89.   for /f "delims=" %%a in ('powershell.exe -noprofile -command $host.ui.rawui.WindowSize.Height') do set $Dlines=%%a
  90.   for /f "delims=" %%a in ('powershell.exe -noprofile -command $host.ui.rawui.WindowSize.Width') do set $Dcols=%%a
  91.   set $cols=%$cols:"=%
  92.   set $lines=%$lines:"=%
  93.   set $cols=%$cols:'=%
  94.   set $lines=%$lines:'=%
  95.   echo;!$cols!|findstr /r "[^0-9]" >nul
  96.   if "!errorlevel!"=="1" (
  97.     echo;!$lines!|findstr /r "[^0-9]" >nul
  98.     if "!errorlevel!"=="1" (
  99.       if !$cols! LSS 15 set /a $cols=15
  100.      if !$lines! LSS 1 set /a $lines=1
  101.       mode con cols=!$cols! lines=!$lines!
  102.     ) else (
  103.       if !$cols! LSS 15 set /a $cols=15
  104.       mode con cols=!$cols! lines=!$Dlines!
  105.     )
  106.   ) else (
  107.     echo;!$lines!|findstr /r "[^0-9]" >nul
  108.     if "!errorlevel!"=="1" (
  109.       if !$lines! LSS 1 set /a $lines=1
  110.       mode con cols=!$Dcols! lines=!$lines!
  111.     ) else (
  112.       mode con cols=!$Dcols! lines=!$Dlines!
  113.     )
  114.   )
  115. ) else (
  116.   set "$cols=%~1"
  117.   set "$lines=%~2"
  118.   if !$cols! LSS 15 set /a $cols=15
  119.   if !$lines! LSS 1 set /a $lines=1
  120.   mode con cols=!$cols! lines=!$lines!
  121. )
  122. goto :eof
  123.  
  124.  
  125.  
  126. pause>nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement