Search found 4506 matches

by aGerman
13 Oct 2022 13:18
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

This is a demo: Another pretty example! :D FWIW You can fade out the window at the very beginning. The ConsoleInfo macro and the MODE command will still work. Even if the window is limpid, it is still there. And better stay with 'echo prompt $E^| cmd.exe' for getting the escape character in order t...
by aGerman
12 Oct 2022 13:33
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

Maybe this will work ... I don't recall if I ever published this macro. However, there's a possibility to make the window fully transparent (pass 100), and opaque again (pass 0). That way you don't need to minimize it. @echo off setlocal EnableDelayedExpansion call :init_transparent echo(&echo set 1...
by aGerman
12 Oct 2022 12:54
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

this is a demo Looks great :D I'm afraid the more spheres you add the longer does it take. The console output is queued. This avoids race conditions. However, it also makes it literally impossible to write output from several processes really at the same time. It might be written interleaved but no...
by aGerman
11 Oct 2022 11:25
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

GetConsoleMode and SetConsoleMode macros along with named flags as described on the MS manpage: @echo off &setlocal enableDelayedExpansion :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Flags to be used to update the bitset returned by the GetConsoleMode macro ::...
by aGerman
10 Oct 2022 13:22
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

Regarding getting/setting the font refer to: https://www.dostips.com/forum/viewtopic.php?f=3&t=10156 Settings can be retrieved and updated using the GetConsoleMode and SetConsoleMode API functions. Refer to one of their manpages to see which of them are supported: https://learn.microsoft.com/en-us/w...
by aGerman
09 Oct 2022 17:10
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

It's probably exactly what you want. The actual window edge is not the visible window edge on Win10. You can observe it by moving the mouse pointer slowly from outside towards a window. The position where the default mouse pointer turns into the double arrow pointer is the actual window edge. It's ~...
by aGerman
09 Oct 2022 16:12
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

It's a mess if you try inferring dots from pixels. I actually trust the values I get from the API because the results are promising. Centering works well for me. And in order to avoid working with the font size in pixels (reported by the Console API), I calculate the size of the character cells in d...
by aGerman
09 Oct 2022 15:29
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

Similarly using a centered window. @echo off rem save this script in UTF-8 set "me=%~f0" setlocal enableDelayedExpansion if "%1"=="sphere" ( call :sphere %2 %3 %4 %5 %6 %7 goto :eof ) title Spheres mode CON: COLS=100 LINES=40 call :GetInfoAndCenter rem multithread 9 thread set /A "deltaX=ConsoleSize...
by aGerman
09 Oct 2022 08:40
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

One of your previous codes updated to: - draw spheres rounder - draw faster - support file names with special characters (like parentheses) - close the window after a key is pressed @echo off rem save this script in UTF-8 set "me=%~f0" setlocal enableDelayedExpansion if "%1"=="" ( rem restart maximi...
by aGerman
09 Oct 2022 06:49
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

I updated the code above to get additional information: - Size of the viewport in dots (the viewport is the "inner" client frame that displays the visible part of the console buffer). - Size of a character cell. I suggest to use this instead of the font size for the calculation of your circle ratio!...
by aGerman
09 Oct 2022 04:07
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

DPI awareness doesn't actually matter as long as both the ConsoleInfo and the move_window macros are not DPI aware. Of course the absolute values you get will probably differ. Made them both DPI aware now: @echo off &setlocal enableDelayedExpansion mode con lines=20 cols=50 :::::::::::::::::::::::::...
by aGerman
08 Oct 2022 17:42
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

The old move_window macro is quite okay. As I said, an update of the ConsoleInfo macro is far more sensible here. In the example below the values for centering are just calculated in the batch code. @echo off &setlocal enableDelayedExpansion mode con lines=20 cols=50 ::::::::::::::::::::::::::::::::...
by aGerman
08 Oct 2022 16:00
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

Well, on what base would you move your window then? You need the rectangle of the monitor's work space (not just the size because the origin of the monitor is not necessarily {0,0}, especially if the virtual screen spans over more than one monitor), and you need the window size. I guess this would n...
by aGerman
08 Oct 2022 14:18
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

There’s more than one way to skin a cat :lol: Let's just try another approach then. @echo off &setlocal EnableDelayedExpansion mode con lines=20 cols=50 set center=powershell -NoProfile -ExecutionPolicy Bypass -Command ^"^ %=% $w=Add-Type -Name WAPI -PassThru -MemberDefinition '^ %===% [DllImport(\"...
by aGerman
08 Oct 2022 09:22
Forum: DOS Batch Forum
Topic: Complete control of cmd windows
Replies: 88
Views: 66718

Re: Complete control of cmd windows

As to my understanding all you want to do is centering in the middle of the screen. You neither need arguments nor all the other types of centering, right? Just shorten the thing to what you're actually looking for. @echo off &setlocal EnableDelayedExpansion mode con lines=20 cols=50 set center=powe...