Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- if not exist DailyTasks (
- md DailyTasks
- attrib +h DailyTasks
- echo "%cd%\ToDoList.bat">"%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Startup.bat"
- )
- :menu
- mode con cols=80 lines=20
- title ToDoList
- cls
- echo ToDoList.bat
- echo (c)2017 Romain Dieu--Guillot
- echo For more information, please go to raiseit.shost.ca
- echo --------------------------------------------------------------------------------
- echo What do you want to do today ^?
- echo write done when finished or leave blank to leave
- set "nb=0"
- :ask
- set "input="
- set /p "input=>"
- set /a nb+=1
- set "task%nb%=%input%"
- if "%input%"=="" goto end
- if "%input%"=="done" goto list
- if "%input%"=="export" goto export
- goto ask
- :list
- echo;!nb!
- for /l %%A in (1,1,%nb%) do (
- call :lenght "!task%%A!"
- cls
- echo.
- echo Tache %%A: %cols% %length% !$cols!
- echo !task%%A!
- pause>nul
- )
- set /a nb-=1
- cls
- echo Congratulation
- echo You completed all today's task.
- pause>nul
- goto menu
- :export
- set /a nb-=1
- for /l %%A in (1,1,%nb%) do (
- (echo Tache %%A:
- echo !task%%A!
- echo.)>>ToDoList.txt
- )
- cls
- echo Task list exported
- pause>nul
- goto menu
- :end
- exit
- :length
- for /f "tokens=1* delims=[]" %%l in ('
- "%comspec% /u /c echo:%~1|more|find /n /v """
- ') do set /a "cols=%%l"
- call :SizeCmdWindow "%cols%" "20" 1
- goto :eof
- :SizeCmdWindow <cols> <lines> <MODE>
- set "$cols=%~1"
- set "$lines=%~2"
- if "%~3"=="" echo;MODE is undefined&pause&goto :eof
- if "%~3"=="0" (
- for /f "delims=" %%a in ('powershell.exe -noprofile -command $host.ui.rawui.WindowSize.Height') do set $Dlines=%%a
- for /f "delims=" %%a in ('powershell.exe -noprofile -command $host.ui.rawui.WindowSize.Width') do set $Dcols=%%a
- set $cols=%$cols:"=%
- set $lines=%$lines:"=%
- set $cols=%$cols:'=%
- set $lines=%$lines:'=%
- echo;!$cols!|findstr /r "[^0-9]" >nul
- if "!errorlevel!"=="1" (
- echo;!$lines!|findstr /r "[^0-9]" >nul
- if "!errorlevel!"=="1" (
- if !$cols! LSS 15 set /a $cols=15
- if !$lines! LSS 1 set /a $lines=1
- mode con cols=!$cols! lines=!$lines!
- ) else (
- if !$cols! LSS 15 set /a $cols=15
- mode con cols=!$cols! lines=!$Dlines!
- )
- ) else (
- echo;!$lines!|findstr /r "[^0-9]" >nul
- if "!errorlevel!"=="1" (
- if !$lines! LSS 1 set /a $lines=1
- mode con cols=!$Dcols! lines=!$lines!
- ) else (
- mode con cols=!$Dcols! lines=!$Dlines!
- )
- )
- ) else (
- set "$cols=%~1"
- set "$lines=%~2"
- if !$cols! LSS 15 set /a $cols=15
- if !$lines! LSS 1 set /a $lines=1
- mode con cols=!$cols! lines=!$lines!
- )
- goto :eof
- pause>nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement