Cmdwiz - 54 operation cmd helper tool (now with Unicode)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Jim W.
Posts: 8
Joined: 28 May 2017 20:46

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#46 Post by Jim W. » 27 Sep 2020 06:56

Well yes Quickedit is enabled. And I have seen it happen again and found it to be intermittent. There is a point where a click takes place immediately prior to that so I'm wondering if it is somehow delayed so it gets registered late and interferes with cmdwiz. I'll try it with out calling cmdwiz.

Disabling Quickedit may not be an option unless there is a way to set that when I create the shortcut (see other post on shortcuts.)

OK, after writing that I removed the two calls. And now I am sure that it is intermittent. What happens is that label is called 2 or 3 times in a row. Sometimes it will make it through all of them and continue as it should, while other times it freezes up on the first or second time. Is there any way to tell exact what is causing cmdwiz to freeze?

btw, I'm experimenting with cmdwiz to see if it can be used in place of this section of code for getting the xy coords.

Code: Select all

for /f "tokens=*" %%A in ('MacroCMD-x64.exe /r /m /d:63 /s ^|findstr "x"')do set xystring=%%A
for /F "tokens=2,3 delims= " %%A IN ("!xystring!") DO (
for /F "tokens=1,2 delims==" %%D IN ("%%A") DO set /a x=%%E
for /F "tokens=1,2 delims==" %%D IN ("%%B") DO set /a y=%%E)
exit /b

Jim W.
Posts: 8
Joined: 28 May 2017 20:46

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#47 Post by Jim W. » 27 Sep 2020 07:13

OK, I think I've isolated the problem. It's not clicking that is causing the freeze but any mouse movement. If I keep the mouse cursor still when it gets to this part is works properly every time. If the mouse is moving it always freezes.

And it is cmdwiz 1.8

Jim W.
Posts: 8
Joined: 28 May 2017 20:46

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#48 Post by Jim W. » 27 Sep 2020 07:37

I disabled Quickedit and the problem persists, intermittently. Here is the log.

C:\AwSim912>call :Get_XY
C:\AwSim912>cmdwiz getmousecursorpos x
C:\AwSim912>set x=473
C:\AwSim912>cmdwiz getmousecursorpos y

(frozen)

But now I find that if I wait 1-3 minutes it will eventually continue, or it may have to do with changing browser tabs while it is frozen.

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#49 Post by misol101 » 27 Sep 2020 10:01

I'm running this script (which also checks for left/right/middle mouse key presses) and don't see an issue here:

Code: Select all

@echo off
for /l %%a in (1,1,500) do call :Get_XY
goto :eof

:Get_XY
cmdwiz getmousecursorpos x
set /a x=%errorlevel%
cmdwiz getmousecursorpos y
set /a  y=%errorlevel%
cmdwiz getkeystate 1 2 4 >nul
set /a "left=%errorlevel% & 1, right=(%errorlevel% >> 1) & 1, middle=(%errorlevel% >> 2) & 1"
echo %x% %y% %left% %right% %middle%
exit /b
Does this script also cause Cmdwiz to hang for you?
The fact that it would hang for 3 minutes only to suddenly start running again seems weird to say the least. Getmousecursorpos doesn't do much more than call the very simple Windows API "GetCursorPos", so there really shouldn't be too much room for things to go haywire.

Maybe we can take this in PM's instead?

Edit: still waiting...

AgamSol
Posts: 3
Joined: 20 Oct 2020 16:46

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#50 Post by AgamSol » 20 Oct 2020 16:48

Hello, i have a bug that all text and backgrounds of fonts are bright, i saw a program that uses this and its not bright like mine any help ?

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#51 Post by misol101 » 23 Oct 2020 04:01

AgamSol wrote:
20 Oct 2020 16:48
Hello, i have a bug that all text and backgrounds of fonts are bright, i saw a program that uses this and its not bright like mine any help ?
Umm... use the "color" command to set the foreground and background color of the terminal. This has nothing to do with Cmdwiz.

For example (for a default palette), to use dark grey color on a black background: color 08

If your terminal palette is messed up for some reason, perhaps the best thing to do would be to modify it in the Defaults of the cmd window.

But you can also change it temporarily with Cmdwiz using the setpalette operation.

Usage: cmdwiz setpalette [RRGGBB[,RRGGBB...]] (first value is color 0, next color 1, etc)

Example, to set cmd's default palette: cmdwiz setpalette 000000,000080,008000,008080,800000,800080,808000,c0c0c0,808080,0000ff,00ff00,00ffff,ff0000,ff00ff,ffff00,ffffff

Illegal Services
Posts: 1
Joined: 03 Aug 2020 13:30

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#52 Post by Illegal Services » 03 May 2021 05:56

CMDwiz bug: blocking/freezing for ~10 secs.
Same problem as: viewtopic.php?f=3&t=7402&start=45#p62976
Proo: https://i.imgur.com/yncTt8F.gif

Already tried to:

Code: Select all

call "cmdwiz.exe"
cmdwiz.exe
cmdwiz
start /b /w cmdwiz
start /b /w cmdwiz.exe
But nothing succeeded in solving this bug...

Also, it seems like we can simulate this bug with the following command:

Code: Select all

for /l %a in (1,1,50) do start "" cmdwiz.exe

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#53 Post by misol101 » 19 May 2023 12:15

Oh my... talk about being back from the dead... Hope everyone is well!

Updated CmdWiz to version 1.9! (link to archive in first post)

Well, as I suddenly had a use for Cmdwiz in a loop, I ran into the issue that had been reported in this thread before (that I conveniently ignored): that cmdwiz sometimes freezes! Well, it took me only 3 years to have a look at it, but I believe the freeze issue is fixed now. It was only present in v1.8, but hey, that's the version that has been up for download for the last 3 years :oops: :oops: I don't expect anyone to actually care at this point, but still the bug was too embarassing not to fix once I experienced it myself.

There are actually 2 other changes too:

1. 'print' operation had some new options added, like printing Unicode characters and Ascii characters based on hex value.

2. 'getkeystate' operation had 'any' added as key code, meaning 'any key'

lazna
Posts: 53
Joined: 27 Dec 2012 10:54

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#54 Post by lazna » 13 Jul 2023 05:36

Just test cmdwiz, and its just GREAT !!

But facing strange behaviour. Command

Code: Select all

cmdwiz insertbmp "\utils\image.bmp" 50 50 & pause >NUL
repeated multiple times by UP ARROW and ENTER keys in console window, randomly DO NOT perform display image. Mostly it display image and it remain on screen untill keypress performed. Sometimes image only flash and disappear, sometimes do absolutelly nothing visible.

Anyone have same experince?

misol101
Posts: 475
Joined: 02 May 2016 18:20

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#55 Post by misol101 » 16 Jul 2023 15:51

lazna wrote:
13 Jul 2023 05:36

Code: Select all

cmdwiz insertbmp "\utils\image.bmp" 50 50 & pause >NUL
repeated multiple times by UP ARROW and ENTER keys in console window, randomly DO NOT perform display image. Mostly it display image and it remain on screen untill keypress performed. Sometimes image only flash and disappear, sometimes do absolutelly nothing visible.

Anyone have same experince?
Read this thread (towards the end) for an explanation: viewtopic.php?f=3&t=7869. Basically, inserting bitmaps into a cmd window won't work unless you switch to "legacy console" in the settings, because with newer consoles, the image typically disappears when the process ends.

There are a few ways around it:
1.Use start /B, like: start /B cmdwiz insertbmp "\utils\image.bmp" 50 50 . I'm not so sure this is a great idea, especially in a loop, but it does seem to work.

2. Use cmdwiz as a server while your script runs. This also means cmdwiz doesn't quit until your script quits, so image stays until then. See "server-cmdwiz-gotoxy-test.bat" in archive for an example.

(3. Switch to legacy console (console must be restarted))

lazna
Posts: 53
Joined: 27 Dec 2012 10:54

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#56 Post by lazna » 13 Aug 2023 04:28

Thanks fro explanation.
Last edited by lazna on 18 Aug 2023 02:08, edited 1 time in total.

lazna
Posts: 53
Joined: 27 Dec 2012 10:54

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#57 Post by lazna » 13 Aug 2023 05:28

As BMP format know transparency, is it possible to make part of image transparent? I mean define specific area of image (and make it transparent) where cmd window content will be visible even if whole cmd windows is overlayed by image?

lazna
Posts: 53
Joined: 27 Dec 2012 10:54

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#58 Post by lazna » 23 Mar 2024 09:35

just discover interesting issue, the cmdwiz 'setbuffersize' behave differently when script is started as a command from existing console window, and when is doubleclicked in windows explorer. But only on _ONE_ of my two machines....

Code: Select all

@echo off
set rows=27
set cols=90

echo Read current settings
c:\utils\cmdwiz.exe getconsoledim

echo Setting up screen itself
mode con cols=%cols% lines=%rows%
c:\utils\cmdwiz.exe getconsoledim

echo Setting up screen buffer
c:\utils\cmdwiz.exe setbuffersize %cols% %rows%
c:\utils\cmdwiz.exe getconsoledim
this script work fine on my desktop computer (4:3) on both cases, but on my laptop (16:9) when is started from console it print following output:

Code: Select all

WIDTH 90 HEIGHT 27 SCREEN_WIDTH 90 SCREEN_HEIGHT 27 SCROLL_X 0 SCROLL_Y 0
WIDTH 90 HEIGHT 27 SCREEN_WIDTH 90 SCREEN_HEIGHT 27 SCROLL_X 0 SCROLL_Y 0
WIDTH 90 HEIGHT 27 SCREEN_WIDTH 90 SCREEN_HEIGHT 27 SCROLL_X 0 SCROLL_Y 0
but when its doubleclicked, behave strange

Code: Select all

WIDTH 93 HEIGHT 27 SCREEN_WIDTH 93 SCREEN_HEIGHT 24 SCROLL_X 0 SCROLL_Y 0
WIDTH 90 HEIGHT 27 SCREEN_WIDTH 90 SCREEN_HEIGHT 25 SCROLL_X 0 SCROLL_Y 0
WIDTH 90 HEIGHT 27 SCREEN_WIDTH 90 SCREEN_HEIGHT 25 SCROLL_X 0 SCROLL_Y 0
could it play a role the fact, if its started from console it inherit default values, but when its doubleclicked, it create a new console window?

desktop 10.0.19045.3996
laptop 10.0.19045.4170

have redistributable script which should have exact same window on any windows 10 powered machines. Is this possible?

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

#59 Post by penpen » 24 Mar 2024 02:46

Usually when opening a console the cmd line is 'C:\Windows\System32\cmd.exe',
while when double clicking a bat the cmd line is 'C:\WINDOWS\system32\cmd.exe /c "<path to batch fie>" ',
which might result in different defaults beeing loaded.

You might check the default values by:
- creating a link to 'cmd.exe', double click it, then right click the window icon on the top left and click properties in the menue poping up.
- creating a batch file that doesn't immediately close (for example use pause), double click it, then right click the window icon on the top left and click properties in the menue poping up.

Usually the mode command sets the lines and columns of the console screen buffer and then tries to resize the console window to display as much as possible.
I'm not familiar with cmdwiz.exe, but i assume using the parameter 'setbuffersize' probably exclusively sets the buffer size without trying to ressize the window to fit, so i wouldn't expect any changes (no matter whether or not it tries to resize the window), because the mode command already did that.

It's somewhat unusual, that the mode command doesn't set the window screen height to the desired value, when it's possible for other console window instances, though.
What comes to my mind ad hoc is, that the bigger window is smaller than the windows desktop size, but bigger than the desktop height minus the taskbar height; a little bit unusual for a screen height of 27 (but possible, for example when you are using an unusual big font height).
Another possibility is that your laptop is using a TrueType font and the screen width/height calculation is a little bit off (which might happen for various reasons, such as windows rejecting to set specific sizes for whatever reason, silently adding 1 or 2 pixels, or characters ignoring any metrics of the TrueType font like the top side bearing). Note that using TrueType fonts in the console always bears the risk that the line heights and widths might vary depending on the characters beeing displayed (because it#s always possible that a character ignores the Trytype font's default sizes or spacings.
Alternatively there might be other explanations for that, which i didn't think of.

In case consolewiz is able to set the window size (though probably set in pixels in case it is able to) you could try that as well, but it most probably will fail, if any user's windows gets to the conclusion that the desktop dimension is too small (for whatever reasons).

I'm not sure whether or not cmdwiz is able to change a TrueType font to a raster font (in case your batch doesn't need to use TrueType fonts), in case that's the issue - mentioning those issues in your documentation would be sufficient in my eyes, but you are not me and might have a different opinion on that, which is perfectly fine.


penpen

Post Reply