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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
misol101
Posts: 458
Joined: 02 May 2016 18:20

Re: Cmdwiz - cmd helper tools (now with Unicode)

#31 Post by misol101 » 07 Sep 2018 01:52

Finally managed to update the instructions above (section 1 and section 10).

The full list of changes for version 1.2 was:

1. As mentioned above, CmdWiz can now use its window operations for other windows than the current console window. See section 1.0 above for an explanation of how it works.
2. Two new operations were added: setwindowsize (see 1.13), and windowlist (see 1.14). The latter is used to get the information needed to specify a window for other window operations.
3. Using another window is also possible for the insertbmp operation (see 10.1). In addition, the /D switch can be used to paste the bitmap straight onto the display, ignoring all windows.
4. Bug fix: the getcharat operation returned incorrect values for extended ascii characters (above 0x80). This was not true for the legacy version cmdwiz-ascii.exe.
5. Bug fix: Using top for the showwindow operation did not work properly.

Also, the archive was restructured by moving a lot of the old gotoxy examples to its own folder, resulting in a less cluttered root folder.

Note that the old cmdwiz-ascii.exe does not have any of the above-mentioned changes and stays version 1.1.

haggy
Posts: 8
Joined: 24 May 2018 03:39

Re: Cmdwiz - cmd helper tools (now with Unicode)

#32 Post by haggy » 07 Sep 2018 05:46

Nice job you have done. Please note that the archive cant be downloaded. can you please send to my mail. hakeemakinde@yahoo.com. Thanks

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

Re: Cmdwiz - cmd helper tools (now with Unicode)

#33 Post by misol101 » 07 Sep 2018 07:28

Yikes. Thanks Mediafire. I'm going to have to do something about that.

EDIT: It might take some time for Mediafire to reply, so I attached a smaller archive here for now. In order to stay below the 100kb limit, it contains only cmdwiz.exe, cmdwiz-ascii.exe, and two example scripts.

EDIT: Haggy, I sent you the full archive

LATE EDIT: This version is now obsolete, use Mediafire download link in first post
Attachments
cmdwiz.zip
Cmdwiz 1.2
(99.45 KiB) Downloaded 247 times
Last edited by misol101 on 18 Dec 2018 11:19, edited 1 time in total.

aGerman
Expert
Posts: 3935
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Cmdwiz - cmd helper tools (now with Unicode)

#34 Post by aGerman » 08 Sep 2018 07:00

You might try to change your code a little. Also try to figure out what AV engine Mediafire uses and upload your changed files to VirusTotal in order to see which engines report false positives.
In my latest reply of the CONVERTCP thread I wrote some possibilities of what you could try. First of all add some properties like version info, copyright, etc. If you need an example resource file for that then just get back to me.

Steffen

haggy
Posts: 8
Joined: 24 May 2018 03:39

Re: Cmdwiz - cmd helper tools (now with Unicode)

#35 Post by haggy » 09 Sep 2018 03:21

misol101 wrote:
07 Sep 2018 07:28
Yikes. Thanks Mediafire. I'm going to have to do something about that.

EDIT: It might take some time for Mediafire to reply, so I attached a smaller archive here for now. In order to stay below the 100kb limit, it contains only cmdwiz.exe, cmdwiz-ascii.exe, and two example scripts.

EDIT: Haggy, I sent you the full archive
Many thanks.

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

Re: Cmdwiz - cmd helper tools (now with Unicode)

#36 Post by misol101 » 21 Sep 2018 12:24

aGerman wrote:
08 Sep 2018 07:00
You might try to change your code a little. Also try to figure out what AV engine Mediafire uses and upload your changed files to VirusTotal in order to see which engines report false positives.
In my latest reply of the CONVERTCP thread I wrote some possibilities of what you could try. First of all add some properties like version info, copyright, etc. If you need an example resource file for that then just get back to me.
MediaFire answered first with a long silence, then a straight no.
So, it seems this is what I will have to do then. Of course, this procedure is complicated by the fact that the archive contains 6 exe files, which VirusTotal claims all contains malicious code of some kind. It has been like that for some time, so I have no idea what was different for this upload.

[begin rant, this is probably flawed in a myriad of ways]
”Too many positives on VirusTotal”, says Mediafire, as if the *number* of positives should be what decides. If we are to take these antivirus programs seriously, then surely even 1 report of ”super dangerous virus” should be enough? But in fact, they seem to mostly just be guessing, so then, I must have reached the treshold of enough blindly reported warnings about malware. Ever notice how the antivirus programs seldom seem to agree on *which* malware or virus is inside an archive or program? For the Cmdwiz/Gotoxy archive it is all over the place, and thus it’s hard to take any of it seriously (of course I know none of my programs contain malware, but if the different antivirus softwares could atleast agree on which virus they claim is in there then atleast it would not seem like they are just guessing blindly without sense.
[end rant]

Interestingly, Mediafire officially claims that all their files are scanned with BitDefender. The interesting part is that according to VirusTotal, BitDefender is *not* reporting any problems inside this archive.

Anyway, sorry for the rant, it’s just the way it is I guess. Steffen, I will contact you shortly.

aGerman
Expert
Posts: 3935
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Cmdwiz - cmd helper tools (now with Unicode)

#37 Post by aGerman » 21 Sep 2018 15:18

That's quite annoying, I know :lol:
I attached a resource file that you can use for C and C++ apps on Windows. I tried to keep it easy for you to update the values (using a little macro magic and some links to the documentations).
Add it to your project, and after the compilation see what file properties were added. Also the number of false positives on VirusTotal should already significantly decrease now.

Steffen
Attachments
dummy.rc.zip
(1.06 KiB) Downloaded 207 times

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

Re: Cmdwiz - cmd helper tools (now with Unicode)

#38 Post by misol101 » 23 Sep 2018 16:45

aGerman wrote:
21 Sep 2018 15:18
That's quite annoying, I know :lol:
I attached a resource file that you can use for C and C++ apps on Windows. I tried to keep it easy for you to update the values (using a little macro magic and some links to the documentations).
Add it to your project, and after the compilation see what file properties were added. Also the number of false positives on VirusTotal should already significantly decrease now.
Mediafire link is back!

Thank you for the resource file! It's nice that I now have details listed in the properties for all executables in the archive.

However, as is often the case, things are not always what they seem. The initial archive had 16 warnings according to VirusTotal. After I added resource files to the executables, it went down... to 15 :) But then I tried making an archive with *only* the 4 executables (no example scripts, no side projects),which resulted in: only 3 warnings!

After a lot of trial and error, it turned out that one of the folders in my zip archive with 15 warnings included another zip file (which was only a zipped up version of exactly the files in its own folder). As soon as I removed that zip file from the archive, the number of warnings went down from 15 to 5! Lesson learned: apparently the AntiVirus programs find it extremely suspicious if a zip file contains another zip file :D Maybe they don't extract recursively, so they just assume the zip in the zip must contain bad things.

To get the whole archive down to 3 warnings, I also had to remove two folders in the archive containing cmdgfx. This means that Taskmon and Listc are no longer included in the gotoxy archive,but that's ok, I have separate archives for them anyway.

I think I will let it stay at 3 warnings for now, atleast that's good enough for Mediafire it seems (and I don't know how to get rid of these remaining warnings). For the record, Cylance, K7GW,and K7AntiVirus still complain.

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

Re: Cmdwiz - cmd helper tools (now with Unicode)

#39 Post by misol101 » 03 Feb 2020 17:31

Release of version 1.4 (link in first post)

What's new:

1. getfullscreen operation added (see 1.15)
2. gettaskbarinfo operation added (see 10.7)
3. bug fix: fullcreen op now working for fullscreen 0 also if running legacy console (even when not forcing legacy mode)
4. gxyinfo op can now also be used to get dimensions of bmp, bxy, and pcx files.
5. setfont op hack: if font 0 is 1x1 pixel, then assume pixelfnt.exe was run (in legacy console) and increase index by 3

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

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

#40 Post by misol101 » 10 Jun 2020 14:13

Release of version 1.5 (link in first post)

What's new:

1. The sendkey operation now allows sending an entire "string" instead of a single virtual key code. This makes it a lot easier to use. For example,in the example script automation-cmdwiz.bat:

Code: Select all

::Previous:
cmdwiz sendkey 0x10 d & cmdwiz sendkey 0x42 p & cmdwiz sendkey 0x10 u
for %%a in (0x59 0x45 0xbe 0xbe 0xbe) do cmdwiz sendkey %%a p

::Now:
cmdwiz sendkey "Bye..."
2. The sendkey operation now also allows an optional count argument to repeat the same key press n times (much faster than e.g running sendkey 200 times to send 200 backspaces) (see 8.4 on first page of this thread)

3. The getdisplaydim operation now returns unscaled screen dimensions (unaffected by the Windows display scale setting). If you do want the scaled version, you can supply the "scaled" optional argument. Note that this is a (potentially) breaking change (but I consider it a bug fix) (see 1.3)

4. Bug fix: The gxyinfo operation no longer fails silently if the file was not found (see 10.6)

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

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

#41 Post by misol101 » 30 Jun 2020 15:49

Updated to version 1.6 (link in first post)

The "scaling issues" release...

What's new:

1. All window operations now use and return unscaled display values. Again, as with getdisplaydim in v1.5, this is a (potentially) breaking change, but this is how I think Cmdwiz should actually behave.

2. New operation: getdisplayscale, that returns the current display scale. This could e.g. be used if you need scaled values for window operations for some reason (see section 1.16 above)

3. The getwindowbounds operation had options excludeBorders and alwaysExcludeBorders added (see 1.4)

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

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

#42 Post by misol101 » 08 Aug 2020 14:40

Cmdwiz version 1.7 (link in first post)

Hopefully a slightly more exciting release than the previous one.

What's new:

1. Server mode. It works similar to cmdgfx server mode, i.e. once the server is running, operations are sent to it using echo, e.g.: echo "cmdwiz: setwindowpos 100 100" . Server mode for Cmdwiz only makes sense for setting things though, not getting, and they should be possible to animate as well. That leaves these operations: setbuffersize setpalette setwindowpos setwindowsize setwindowtransparency print setcursorpos showcursor sendkey setmousecursorpos copyblock moveblock insertbmp.

So what good is the server? Simple, it allows the user to smoothly animate things such as window position, mouse position etc. However, to get full control of speed and FPS, an input server is needed as well, which is why I also included cmdgfx_input.exe in the archive.

More info in 10.8 on first page of this thread.

Try running server-cmdwiz-gotoxy-test.bat for an example, it smoothly animates the console window position, mouse cursor pos, cursor pos, window transparency, and a bitmap image as well, all at the same time.

1.1 Gotoxy.exe, also in the archive, also had server mode added. See viewtopic.php?t=7129 for more info. Uncomment line 58 in aforementioned server-cmdwiz-gotoxy-test.bat to try out gotoxy server as well.


2. Operations that can use other windows than the console now attempts to find the "main" window, i.e the one that will actually respond to operations like setwindowpos, showwindow etc. Often, many windows share the same process/thread ID/name, but Cmdwiz should now usually select the right one without having to manually identify the correct window handle or title.

There are still cases where it may fail or select the "wrong" window. For example, browsers like Firefox may have several "main" windows open at the same time, in which case Cmdwiz will choose the first one it finds. Thus, in that case it will still be necessary to specify the exact window handle or title.

See 1.0 for more info.


3. Also for window searches, the default for finding title and process name is now "starts with" rather than "match full name". Also, both searches are now case insensitive. To force FULL string match for the title, specify :F at the end of the search string, like "/w:FullWindowTitle:F"

See 1.0 for more info.


4. Improved base help text (the one seen when writing just "cmdwiz" or "cmdwiz /?"). Operations were split into sections and ordered alphabetically.


(5. Code cleanup, gcc now compiles Cmdwiz with no warnings even with all extra warnings enabled. Removed globals, added const/static, etc). Won't affect the user though)

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

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

#43 Post by misol101 » 24 Aug 2020 16:05

Cmdwiz version 1.8 (link in first post)

The "Does size matter?" release :mrgreen:

This version contains NO new features or fixes.Instead it focuses on executable size.

Even though it was never really a concern of mine, several people (including in this thread) have commented that they think the Cmdwiz executable is too large.

Cmdwiz v1.7 is 65 kb. How much smaller can we make it?

Step 1: Compile with -nostartfiles. Result: 55 kb
Step 2: Compile with -Os instead of -O2. Result: 48 kb
Step 3: Pack the executable with UPX (reportedly used for all Nirsoft executables) (https://upx.github.io/). Result: 21 kb

Since a user in this thread asked to remove all help texts from the executable, I got a little curious how much difference that would make (even though I don't think it's a good idea)
Step 2.5: Define some macros to remove all help texts. Result: 40 kb
Step 3: Pack again with UPX. Result: 18 kb

Now, the only version I've actually put in the archive linked to in the first post is the 48 kb one (unpacked, with help texts). That's still a 17kb improvement from v 1.7.

However, I linked in this post an archive with the other versions. So, if your answer to "Does size matter?" is a resounding YES, you can now choose to run the 21 or 18 kb Cmdwiz version. That's 54 operations in 18kb, are we ok now? :)


Also, I did the same steps with gotoxy.exe 1.2 (except removing help). The exe went from 35kb to 25kb unpacked, and 13kb when UPX packed. These versions are also in the archive below.


(For the small-size enthusiast, UPX can also decrease file sizes of Cmdgfx quite a bit: cmdgfx.exe:196kb->80kb, cmdgfx_gdi.exe:320kb->101kb, cmdgfx_RGB.exe:348kb->113kb )
Attachments
cmdwiz&gotoxy-size-optimized.zip
(98.07 KiB) Downloaded 28 times

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

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

#44 Post by Jim W. » 27 Sep 2020 01:44

Any idea why calling this would result in my batch program locking up before the exit /b, sometimes at the first call and sometimes at the second?

Code: Select all

:Get_XY
call cmdwiz getmousecursorpos x
set x=%errorlevel%
call cmdwiz getmousecursorpos y
set y=%errorlevel%
exit /b
Well, after I wrote that I tried changing to cmdwiz-ascii and it worked fine. So I changed back to cmdwiz and it worked fine. If it freezes up again I'll report back. Will be curious to see if the problem repeats after I reboot.

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

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

#45 Post by misol101 » 27 Sep 2020 02:57

Jim W. wrote:
27 Sep 2020 01:44
Any idea why calling this would result in my batch program locking up before the exit /b, sometimes at the first call and sometimes at the second?

Code: Select all

:Get_XY
call cmdwiz getmousecursorpos x
set x=%errorlevel%
call cmdwiz getmousecursorpos y
set y=%errorlevel%
exit /b
Well, after I wrote that I tried changing to cmdwiz-ascii and it worked fine. So I changed back to cmdwiz and it worked fine. If it freezes up again I'll report back. Will be curious to see if the problem repeats after I reboot.
No idea to be honest, but do report back if it should happen again. This is v1.8?
I don't think that's the cause, but why are you running cmdwiz with "call"? There is no reason (as far as I know) to do that.

(If quick-edit is enabled in the console window and you accidentally clicked in the window, execution will pause. But I assume it is not what's happening?)

Post Reply