Batch Animated Text
Moderator: DosItHelp
-
- Posts: 1
- Joined: 26 Mar 2015 07:36
Batch Animated Text
How do i do animated text like the following:
frame 1) H
frame 2) HE
frame 3) HEL
frame 4) HELL
frame 5) HELLO
but yet, i dont want to do:
echo H
ping localhost -n 1 >nul
cls
echo HE
because it takes up a lot of space and time
Thanks in Advanced
frame 1) H
frame 2) HE
frame 3) HEL
frame 4) HELL
frame 5) HELLO
but yet, i dont want to do:
echo H
ping localhost -n 1 >nul
cls
echo HE
because it takes up a lot of space and time
Thanks in Advanced
Re: Batch Animated Text
Code: Select all
@echo off &setlocal
:: create a backspace character
for /f %%i in ('"prompt $H &for %%b in (1) do rem"') do set "bs=%%i"
:: animate the string
for %%i in (
H E L L O "," " " W O R L D !
) do (<nul set /p "=.%bs%%%~i" & >nul ping -n 1 localhost)
:: add a line break
echo(
pause
As you can see the characters are separated by spaces. Token separators (such as spaces or commas) have to be enclosed into quotation marks.
Regards
aGerman
Re: Batch Animated Text
This is a simple method to solve your question:
Code: Select all
@echo off
for %%a in (H HE HEL HELL HELLO) do (
cls
echo %%a
ping -n 2 "">nul
)
pause
Re: Batch Animated Text
SpinSpell.bat ["Message goes here"] [spincount] [spindelay]
Code: Select all
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%a in ('"prompt $H&for %%b in (1) do rem"') do set "$BS=%%a"
SET /A SpinCount=7,MaxSpinCount=30,Spin_Delay=4,ctr=0
SET "_MSG=ÛÛÛÛÛÛÛÛÛÛÛÛÛ"
IF NOT [%1]==[] (
SET "_MSG=%~1"
if defined %~1 set "_msg=!%~1!"
)
IF NOT [%2]==[] SET /A SpinCount=%~2
IF NOT [%3]==[] SET /A Spin_Delay=%~3
IF %SpinCount% GTR %MaxSpinCount% SET /A SpinCount=MaxSpinCount
SET "Spinner=³/Ä\"
call :strln _msg slen
set/a slen-=1
FOR /L %%a in (0 1 %slen%) DO (
FOR /L %%A IN (1,1,%SpinCount%) DO (
CALL :Delay %Spin_Delay%
<nul CALL SET/P="%$BS%%%Spinner:~!ctr!,1%%"
SET /A CTR=%%A %% 4
)
<nul set/p="%$BS%!_MSG:~%%a,1! "
)
ENDLOCAL & EXIT /B
:Strln
( SetLocal
set "str=A!%~1!"
set "len=0"
for /L %%A in (12,-1,0) do (
set /a "len|=1<<%%A"
for %%B in (!len!) do if "!str:~%%B,1!"=="" set /a "len&=~1<<%%A"
)
)
EndLocal&( REM RETURN VALUES
if "%~2" NEQ "" set/a %~2=%len%
)&exit /b %len%
:Delay centiseconds
setlocal
set/a delay=%~1
for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "time1=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100
:wait
for /f "tokens=1-4 delims=:.," %%a in ("!time: =0!") do set /a "time2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, tDiff=time2-time1"
if %tDiff% lss 0 set /a tDiff+=24*60*60*100
if /i %tDiff% geq %delay% endlocal&goto :eof
goto :wait
Last edited by carlsomo on 21 Apr 2015 02:10, edited 1 time in total.
Re: Batch Animated Text
Code: Select all
@Echo Off
SetLocal EnableDelayedExpansion
Set "txt=HELLO"
For /L %%# in (0,1,4) Do (Set /P "=!txt:~%%#,1!" <Nul
Ping.exe -l 0 -n 1 -w 500 1.0.0.0 >nul
)
Echo(
PAUSE
Goto :Eof
Re: Batch Animated Text
Code: Select all
@powershell "gc '%~f0'|select -skip 1|%%{$_.getenumerator()|%%{write-host $_ -nonewline -foregroundcolor yellow -backgroundcolor darkgreen;sleep -milliseconds 100};''}"& pause>nul& exit/b
Hello, Flaming_PC!
Here you can place
any large text.
Re: Batch Animated Text
carlsomo wrote:SpinSpell.bat ["Message goes here"] [spincount] [spindelay]Code: Select all
*snip*
:wait
set timen=%time: =%
if /i %timen% geq %time2% goto :end
goto :wait
*snip*
shouldn't that be:
Code: Select all
set timen=%time:~0,8%
[/code]
Because otherwise i get a Syntax error message:
Code: Select all
D:\set timen=15:15:02,59
"59" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
but even without the error it wont work. it shows me literally nothing.
Is there an additional error in the script or am i just to stupid to use it?
Re: Batch Animated Text
Code: Select all
@for /f %%i in ('^<"%~f0" find/c /v ""') do @(
for /f "delims=:" %%j in ('findstr/enc:"& :::::" "%~f0"') do @<"%~f0" (
for /f %%k in ('forfiles /m "%~nx0" /c "cmd /c echo 0x08"') do @(
for /l %%l in (1 1 %%i) do @(
set x=& set/p x=&if %%l gtr %%j (
if not defined x (echo.) else (
if defined * (echo.) else (set *=*)
for /f "delims=" %%m in ('cmd/u/v/c echo.!x!^| more^| findstr/n "^"') do @set y=%%m& (
for /f "delims=" %%n in ('cmd/v/c echo."!y:*:=!"') do @<nul (
if %%n neq " " (if %%n neq "=" (set/p=%%n) else (set/p=.%%k=)) else (set/p=.%%k %)
>nul ping -n 1 -w 100 ""
)
)
)
)
)
)
)
)
@pause>nul& exit/b& :::::
Hello, Flaming_PC!
Here you can place
any large English text.
"="="="="="="="="=
Re: Batch Animated Text
AiroNG
My time is format h:mm:ss.hs yours has a comma h:mm:ss,hs
so add a comma to the delimeters in this for loop in the delay routine:
Then it should work. I have only tested on Win7.
My time is format h:mm:ss.hs yours has a comma h:mm:ss,hs
so add a comma to the delimeters in this for loop in the delay routine:
Code: Select all
for /f "tokens=1-4 delims=:.," %%a in ("%time1%") do (
Then it should work. I have only tested on Win7.
Re: Batch Animated Text
carlsomo wrote:AiroNG
My time is format h:mm:ss.hs yours has a comma h:mm:ss,hs
so add a comma to the delimeters in this for loop in the delay routine:Code: Select all
for /f "tokens=1-4 delims=:.," %%a in ("%time1%") do (
Then it should work. I have only tested on Win7.
So I am stupid then
Ok, i will test it after i get back home. Thank you.
Re: Batch Animated Text
AiroNG
I apologize for not recognizing the variables in DOS related to regional and language settings. I am usually pretty happy getting something to work in one version, mine.
Carl
I apologize for not recognizing the variables in DOS related to regional and language settings. I am usually pretty happy getting something to work in one version, mine.
Carl