Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- title Trickkiste
- setlocal EnableDelayedExpansion
- color 07
- mode con:cols=105 lines=35
- :init
- REM Initialize...
- REM Enable colored echo (header)...
- for /F "tokens=1 delims=#" %%i in ('"prompt $H# & for %%i in (1) do rem"') do (
- set DEL="%%i"
- )
- echo.
- call :echocol "0C" "this is red"
- echo.
- call :echocol "0E" "this is yellow"
- echo.
- call :echocol "0A" "this is green"
- echo.
- call :echocol "09" "this is blue"
- echo.
- echo Initializing...
- call :progbar "500"
- echo.
- echo Checking connection...
- call :progbar "50"
- echo.
- call :spechar "test $E this was test"
- echo.
- call :spechar "$L$G$C$F$A$E"
- echo.
- call :setdelay "variable" "Bitte treffen Sie Ihre Eingabe" "30"
- echo Ihre Eingabe war: "%variable%"
- echo.
- call :setdelay "variable" "Bitte treffen Sie eine andere Eingabe, diese war ungueltig" "58"
- echo Ihre Eingabe war: "%variable%"
- echo.
- call :echodelay "WICHTIG: Lassen Sie niemals Ihren PC unbeaufsichtigt - ein unbeaufsichtigter PC stellt eine Gefahr dar." "103"
- echo.
- call :echodelay "counting one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteenseventeen eighteen nineteen twenty twenty-one twenty-two ..." "165"
- echo.
- echo.
- echo
- pause
- goto :eof
- :echocol
- REM Enable colored echo (footer)...
- REM Usage: call :echocol "XY" "TEXT"
- REM where "XY" is the colorcode
- REM where "TEXT" is the text (no special chars)
- cd /D %TEMP%
- <nul set /P .=%DEL%>"%~2"
- findstr /V /A:%~1 /R "nul" "%~2" nul
- del /F /Q "%~2">nul
- cd /D "%~dp0"
- goto :eof
- :echodelay
- REM Enable echo delayed...
- REM Usage: call :echodelay "TEXT" "LENGTH"
- REM where "TEXT" is the text of the string
- REM where "LENGTH" is the length of the string
- echo wscript.sleep "30">"%TEMP%\sleep.vbs"
- for /L %%i in (0,1,%~2) do (
- set tempstring=%~1
- if /I "!tempstring:~%%i,2!"=="!tempstring:~%%i,1! " (
- set /P %~1="!tempstring:~%%i,1! "<nul
- ) else (
- set /P %~1="!tempstring:~%%i,1!"<nul
- )
- wscript "%TEMP%\sleep.vbs"
- )
- del /F /Q "%TEMP%\sleep.vbs">nul
- echo.
- goto :eof
- :setdelay
- REM Enable set variable with shown example delayed...
- REM Usage: call :setdelay "VAR" "TEXT" "LENGTH"
- REM where "VAR" is the name of the variable
- REM where "TEXT" is the text of the string
- REM where "LENGTH" is the length of the string
- echo wscript.sleep "50">"%TEMP%\sleep.vbs"
- for /L %%i in (0,1,%~3) do (
- set %~1_sub=%~2
- if /I "%%i"=="%~3" (
- set /P %~1=": "
- ) else (
- if /I "!%~1_sub:~%%i,2!"=="!%~1_sub:~%%i,1! " (
- set /P %~1="!%~1_sub:~%%i,1! "<nul
- ) else (
- set /P %~1="!%~1_sub:~%%i,1!"<nul
- )
- )
- wscript "%TEMP%\sleep.vbs"
- )
- del /F /Q "%TEMP%\sleep.vbs">nul
- goto :eof
- :progbar
- REM Enable progress bar...
- REM Usage: call :progbar "X"
- REM where "X" is the sleep-amount per percent in milliseconds
- echo wscript.sleep "%~1">"%TEMP%\sleep.vbs"
- for /L %%i in (1,1,10) do (
- if /I "%%i"=="10" (
- set /P progbar="±±±±±±±±±° 100%%"<nul
- ) else (
- set /P progbar="±±±±±±±±±°"<nul
- )
- wscript "%TEMP%\sleep.vbs"
- )
- del /F /Q "%TEMP%\sleep.vbs">nul
- goto :eof
- :spechar
- REM Enable special characters...
- REM Usage: call :spechar "X"
- REM where "X" is your string with several character codes from A-Z and 0-9 with $ in front of, e.g. "test $E this was test"
- for /F "tokens=1 delims=#" %%i in ('"prompt %~1# & for %%i in (1) do rem"') do (
- echo %%i
- )
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement