Why you didn't tested my solution as I wrote it (more than one month ago)?
The last code you tested have duplicated the line # 45 and inserted an additional line # 48: del spacesFile.txt that is the cause that your code (not the mine!) don't works...
Antonio
Timeout with GUI adjustments breaks its design after first second passes
Moderator: DosItHelp
Re: Timeout with GUI adjustments breaks its design after first second passes
As I have just now tested this once more: that codeAacini wrote: ↑18 Nov 2023 12:07Why you didn't tested my solution as I wrote it (more than one month ago)?
ends up showing to meAacini wrote: ↑13 Oct 2023 18:33Code: Select all
@echo off cls echo/ echo Info about what the script will do echo/ setlocal EnableDelayedExpansion rem Get an ASCII CR (13) character for /F %%a in ('copy /Z "%~F0" NUL') do set "CR=%%a" rem Create a file with *just* 3 spaces call :CreateSpacesFile 3 set "countdown=3" echo Executing in: echo/ for /L %%i in (%countdown%,-1,1) do ( type SpacesFile.txt <nul set /p "=%%i!CR!" ping 127.0.0.1 -n 2 > nul ) :: Here be dragons echo The script has been executed echo/ echo [Press any key to close this CMD window] echo/ pause > nul goto :EOF :CreateSpacesFile numOfSpaces setlocal EnableDelayedExpansion set "spcs=" for /L %%i in (1,1,%1) do set "spcs=!spcs! " set /P ^"=X^ % Do not remove this line % %spcs%^" > spacesFile.tmp < nul findstr /V "X" spacesFile.tmp > spacesFile.txt del spacesFile.tmp exit /B
and leaves behind a leftover in form of the spacesFile.txt file, even after I close the CMD windowInfo about what the script will do
Executing in:
3The 2The 1The The script has been executed
[Press any key to close this CMD window]
As for
it does not help when I remove those two lines, i.e. usingAacini wrote: ↑18 Nov 2023 12:07The last code you tested have duplicated the line # 45 and inserted an additional line # 48: del spacesFile.txt that is the cause that your code (not the mine!) don't works...
Code: Select all
@echo off
cls
echo/
echo Info about what the script will do
echo/
setlocal EnableDelayedExpansion
rem Get an ASCII CR (13) character
for /F %%a in ('copy /Z "%~F0" NUL') do set "CR=%%a"
rem Create a file with *just* 3 spaces
call :CreateSpacesFile 3
set "countdown=3"
echo Executing in:
echo/
for /L %%i in (%countdown%,-1,1) do (
type SpacesFile.txt
<nul set /p "=%%i!CR!"
ping 127.0.0.1 -n 2 > nul
)
:: Here be dragons
echo The script has been executed
echo/
echo [Press any key to close this CMD window]
echo/
pause > nul
goto :EOF
:CreateSpacesFile numOfSpaces
setlocal EnableDelayedExpansion
set "spcs="
for /L %%i in (1,1,%1) do set "spcs=!spcs! "
set /P ^"=X^
% Do not remove this line %
%spcs%^" > spacesFile.tmp < nul
findstr /V "X" spacesFile.tmp > spacesFile.txt
del spacesFile.tmp
exit /B
and of course creates the issue of the spacesFile.txt being left over in the folderInfo about what the script will do
Executing in:
3The 2The 1The The script has been executed
[Press any key to close this CMD window]
I already had thought about using Power Shell for this
But [as already have noted it here viewtopic.php?f=3&t=10887&p=69007#p69096] currently in the Windows Console [conhost.exe] it is most likely impossible to see digits of a countdown at the bottom of window while also retaining ability to scroll it up an not have the view being thrown back down after passing of another second. The new Windows Terminal [windowsterminal.exe] however will not snap to the bottom on output if user scrolls up- it only snaps to the bottom on output if user is already at the bottom of window when it occurs
And so, as Windows Terminal by default replaces the old Windows Terminal since Windows 11 22H2, but installing it on older systems has many prerequisites [https://github.com/Microsoft/Terminal#prerequisites] - thus it is easier for me to just wait out this issue. [More info:
https://github.com/microsoft/terminal/issues/15962]
Thus I think there is no sense in continuing this wild goose chase - as in the end I must be able to freely scroll freely the screen up and down when the countdown takes place
Thank you for your help