Search found 29 matches
- 02 Mar 2024 19:04
- Forum: DOS Batch Forum
- Topic: Mouse Events are detected far less in a GOTO loop vs FOR /L loop
- Replies: 4
- Views: 9928
Re: Mouse Events are detected far less in a GOTO loop vs FOR /L loop
Ah unfortunate. I was thinking perhaps this behaviour could be explained by some obscure CMD.exe behavioiur, which this forum is perfect for
- 01 Mar 2024 19:17
- Forum: DOS Batch Forum
- Topic: Mouse Events are detected far less in a GOTO loop vs FOR /L loop
- Replies: 4
- Views: 9928
Re: Mouse Events are detected far less in a GOTO loop vs FOR /L loop
I was wondering if you guys had any idea what the difference between the two loops are, and why it would cause such a difference? We know that GOTO and CALL are implemented very inefficiently in the cmd.exe shell. There have been many discussions about this on this forum. To get the best performanc...
- 27 Feb 2024 22:39
- Forum: DOS Batch Forum
- Topic: Mouse Events are detected far less in a GOTO loop vs FOR /L loop
- Replies: 4
- Views: 9928
Mouse Events are detected far less in a GOTO loop vs FOR /L loop
Hey guys, Recently I have been making a cmd extension that takes mouse and keyboard input implicitly into the variable CMDCMDLINE. I got inspiration when I saw this post https://www.dostips.com/forum/viewtopic.php?f=3&t=4312 about CMDCMDLINE. It works well, except, when used in a GOTO loop, many mou...
- 11 Jan 2024 21:26
- Forum: DOS Batch Forum
- Topic: Faster batch macros
- Replies: 17
- Views: 31593
Re: Faster batch macros
This is cool. Thought of a fun way to do it, though haven't tested it inside a macro or anything. This way the 2 FOR loops aren't needed, though the string is much longer. @ECHO ON SETLOCAL ENABLEDELAYEDEXPANSION SET "v=1" FOR /F "tokens=2-7" %%1 in ("!! SET REM ENABLEDELAYEDEXPANSION END REM LOCAL"...
- 12 Jun 2022 12:44
- Forum: DOS Batch Forum
- Topic: Redirect carriage return to file in loop
- Replies: 10
- Views: 8326
Re: Redirect carriage return to file in loop
@Aacini that is true, however since I'm using this code in a large loop that is being read by another program, it slows down by quite a bit. I was just wondering if there was a cool trick to do it without redirecting to a new file each time and preferably in pure Batch.
- 11 Jun 2022 11:22
- Forum: DOS Batch Forum
- Topic: Redirect carriage return to file in loop
- Replies: 10
- Views: 8326
Re: Redirect carriage return to file in loop
@Aacini yes that is exactly what I would like to do, to move the file pointer all the way to the start. Hence a loop like this (example) (FOR %%G in (1, 2, 3) DO ( ECHO %%G ))>output.txt output.txt would just have 3 Your FilePointer.exe is a good solution, though I was wondering if a pure Batch solu...
- 10 Jun 2022 15:55
- Forum: DOS Batch Forum
- Topic: Redirect carriage return to file in loop
- Replies: 10
- Views: 8326
Re: Redirect carriage return to file in loop
Thanks, appreciate your explanation. Was just hoping there was some cool way to get this to work, but I was totally off the map
- 10 Jun 2022 12:56
- Forum: DOS Batch Forum
- Topic: Redirect carriage return to file in loop
- Replies: 10
- Views: 8326
Redirect carriage return to file in loop
Hello, I'm looking to print to a file but replacing the same line each time. I thought of trying to output a carriage return but that did not work @ECHO OFF :MAIN SETLOCAL ENABLEDELAYEDEXPANSION FOR /F %%A in ('COPY "%~f0" NUL /Z') DO SET "CR=%%A" (FOR %%G in (1 2 3) DO ( <NUL SET /P "=%%G !CR!" ))>...
- 25 Nov 2021 10:07
- Forum: DOS Batch Forum
- Topic: Coding challenge for any interested parties
- Replies: 20
- Views: 19358
Re: Coding challenge for any interested parties
An updated with version with no number literals/misc changes. @ECHO OFF SET /P "str=Enter string : " SET /P "max=Enter number : " SET /A "num=o=PROCESSOR_LEVEL / PROCESSOR_LEVEL", "t=o + o", "z=o - o" CALL SET "str=%%str:~,%max%%%" ( ECHO :LOOP ECHO CALL :"%%str:~0,%o%%%" %t%^>NUL ECHO ECHO %%num%%:...
- 24 Nov 2021 12:21
- Forum: DOS Batch Forum
- Topic: Coding challenge for any interested parties
- Replies: 20
- Views: 19358
Re: Coding challenge for any interested parties
Almost there - It is indeed possible to generate variables with Integer values without using literal numbers. Outside of that, your script fails to terminate at the input maximum index, which I'm sure you can resolve. Ah the solution is so simple...yet so obvious! Though, I'm not sure what you mean...
- 23 Nov 2021 23:24
- Forum: DOS Batch Forum
- Topic: Coding challenge for any interested parties
- Replies: 20
- Views: 19358
Re: Coding challenge for any interested parties
I just thought of an interesting solution, but it doesn't fit the requirements (no number literals) and I don't think it's possible without them, so I'll just post it here. @ECHO OFF SET /P "str=Enter string : " SET /P "max=Enter number : " SET "num=1" ( FINDSTR "^;" "%~f0" ECHO :%max% ECHO PAUSE EC...
- 13 Jun 2021 17:01
- Forum: DOS Batch Forum
- Topic: Button functions via VT100, and Mouse.exe
- Replies: 3
- Views: 25056
Re: Button functions via VT100, and Mouse.exe
Interesting. I've made something similar using Powershell instead of mouse.exe, though the method I use means it only works in full screen. I remember seeing a post by Aacini to multithread Powershell, so I used this snippet POWERSHELL ^ Add-Type -AssemblyName System.Windows.Forms; ^ $A = [math]::ro...
- 07 Dec 2020 21:17
- Forum: DOS Batch Forum
- Topic: Batch Games
- Replies: 31
- Views: 74477
Re: Batch Games
Hey that's a pretty cool snake! Here's my super basic version using VT100 sequences in pure Batch, inspired by dbenham's I like how you've managed to keep it pure batch, however I found your controller to not be as reliable as I'd like Also is it by intent the player can collide with their tail by ...
- 07 Dec 2020 13:10
- Forum: DOS Batch Forum
- Topic: Batch Games
- Replies: 31
- Views: 74477
Re: Batch Games
Hey that's a pretty cool snake! Here's my super basic version using VT100 sequences in pure Batch, inspired by dbenham's @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION IF not "%1" == "" ( GOTO :%1 ) TITLE Snake FOR /F %%A in ('ECHO prompt $E^| cmd') DO SET "ESC=%%A" (CHCP 65001)>NUL SET "mov[W]=y]-=1" SE...
- 25 Sep 2020 16:54
- Forum: DOS Batch Forum
- Topic: Batch Games
- Replies: 31
- Views: 74477
Re: Batch Games
@misol101
Thanks. I had a hard time adding stuff to make gameplay better, since the performance would drop really low, or it would be unwieldy in batch. But yeah, I tried to compensate with some extra effort into story.
Thanks. I had a hard time adding stuff to make gameplay better, since the performance would drop really low, or it would be unwieldy in batch. But yeah, I tried to compensate with some extra effort into story.