Advertisement
Vector45555

1

Feb 10th, 2022
1,480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.70 KB | None | 0 0
  1. @echo off
  2. color 1
  3. title Happy Valentines Day
  4. goto reg
  5. :::       This is for the first time being opened
  6.  
  7. :reg
  8. set "regfile=%cd%\reg.txt"
  9. if exist "%regfile%" goto home
  10. ::        First time opened message
  11. cls
  12. echo Hey, this appears the first time you open this up, so press any button to start, or you can close now and wait a bit.
  13. echo.
  14. echo (You can reopen it later if you want later)
  15. echo Also, there is alot of text, I tried to space it out, but you will want to make this tab bigger to read it better, you can also highlight it if you need
  16. echo.
  17. pause
  18. cls
  19.  
  20. ::: Message
  21. echo It's Me
  22. pause
  23. echo opened>"%regfile%"
  24. cls
  25. :::       Menu
  26. :home
  27. cls
  28.     echo.
  29.     echo ---------------------------
  30.     echo Menu            
  31.     echo ---------------------------
  32.     echo.
  33.     echo.
  34.     echo 1. Random Message
  35.     echo 2. Replay
  36.     echo.
  37.     choice /c:12 /M "Please choose an action: "
  38.     echo.
  39.  
  40.     if %errorlevel%==1 call :note
  41.     if %errorlevel%==2 call :rep
  42.  
  43. :::       Random line grabber
  44. :note
  45. cls
  46. REM This is where the notes are
  47. SET "TextFile=list.txt"
  48.  
  49. REM Determine the number of lines
  50. FOR /f %%a IN ('type "%textfile%"^|find /c /v ""') DO SET /a numlines=%%a
  51.  
  52. REM Pick a random line
  53. SET /A RandomLine=(%RANDOM% %% %NumLines%)
  54.  
  55. REM Prevent skipping all the lines
  56. IF "%RandomLine%"=="0" (SET "RandomLine=") ELSE (SET "RandomLine=skip=%randomline%")
  57.  
  58. REM Print the random line
  59. FOR /F "usebackq tokens=* %RandomLine% delims=" %%A IN (`TYPE %TextFile%`) DO (
  60.     echo.
  61.     ECHO %%A
  62.     echo.
  63.     GOTO sub
  64. )
  65. :sub
  66.     echo Would you like another(1), or go back (2)
  67.         choice /c:12 /M "Please choose an action: "
  68.             if %errorlevel%==1 call :note
  69.             if %errorlevel%==2 call :home
  70.  
  71.  
  72. :end
  73. close
  74. :rep
  75. del reg.txt
  76. goto reg
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement