Channel database

[Tutorial] How to use mouse in batch files

MarkusTegelane


In this tutorial I will show you how you can use mouse in batch files. This tutorial also has a way of doing noflicker system in batch (basically the replacement for CLS).

Code used for this batch file can be found here: https://pastebin.com/vpDCMNxN

BG.EXE: https://www.dostips.com/forum/viewtopic.php?t=4094 (copy and paste the code at the bottom into a bat file and run it to build bg.exe)


Published: May 29 2017
Filename: mt_mouse.avi
Category: Batch files


Open video (YouTube)
Open video (Odysee)
Go back

Properties

Tags

resident evil 4 mouse patch
Batch file
.bat
Tutorial
File format
Computer mouse
Mouse
Batch file tricks
batch file tricks
batch file tricks notepad
cool batch file tricks
How
Make
Howto
batch file game tutorial
batch file programming tutorial
batch file programming tutorial full
batch file programming tutorial in hindi
batch file programming tutorial in tamil
batch file tutorial
batch file tutorial for beginners
batch file tutorial windows
batch file tutorials

Comments


@TheBATeam manage

Great Work! We were also dealing with the same problem. And, Created a simple and portable - easy to use alternative instead coding big. :) We named The Solution as - Button Function (v1.0 & 2.0).<br /> <br /> Still Your method teaches the creating things from scratch. Great video. Keep it up!

Reply👍14👎5




@markusTegelane manage

Thank you! The tokens in the for command were incorrect, because I made this video with a different version of bg.exe that didn't detect which mouse button you pressed (so the output of "bg.exe mouse" looked something like 21 52, unlike the new version where it is 1 21 52). That is why you might actually get 21x1 as the coordinate in my script, even tough it's supposed to be 52x21.

Reply👍6👎6




@Ron55O manage

@markusTegelane You're welcome!

Reply👍6👎5




@saikumarsonti8709 manage

Hi I want to know how i can automate select/run specific application and once opened need to click on specific place, can you pls help

Reply👍7👎6




@xxlarrytfvwxx9531 manage

I got an 404 Error.

Reply👍11👎6




@markusTegelane manage

Thank you! The tokens in the for command were incorrect, because I made this video with a different version of bg.exe that didn't detect which mouse button you pressed (so the output of "bg.exe mouse" looked something like 21 52, unlike the new version where it is 1 21 52). That is why you might actually get 21x1 as the coordinate in my script, even tough it's supposed to be 52x21.

Reply👍9👎3




@Ron55O manage

@markusTegelane You're welcome!

Reply👍6👎6




@saikumarsonti8709 manage

Hi I want to know how i can automate select/run specific application and once opened need to click on specific place, can you pls help

Reply👍8👎7




@yeastchan7359 manage

Maybe a new link for "bg.exe" pls?

Reply👍7👎6




@markusTegelane manage

Thank you! The tokens in the for command were incorrect, because I made this video with a different version of bg.exe that didn't detect which mouse button you pressed (so the output of "bg.exe mouse" looked something like 21 52, unlike the new version where it is 1 21 52). That is why you might actually get 21x1 as the coordinate in my script, even tough it's supposed to be 52x21.

Reply👍7👎6




@Ron55O manage

@markusTegelane You're welcome!

Reply👍7👎6




@saikumarsonti8709 manage

Hi I want to know how i can automate select/run specific application and once opened need to click on specific place, can you pls help

Reply👍7👎7




@amorcreencia manage

the link in the desc box does not have attachments

Reply👍7👎3




@markusTegelane manage

Thank you! The tokens in the for command were incorrect, because I made this video with a different version of bg.exe that didn't detect which mouse button you pressed (so the output of "bg.exe mouse" looked something like 21 52, unlike the new version where it is 1 21 52). That is why you might actually get 21x1 as the coordinate in my script, even tough it's supposed to be 52x21.

Reply👍8👎6




@Ron55O manage

@markusTegelane You're welcome!

Reply👍8👎6




@saikumarsonti8709 manage

Hi I want to know how i can automate select/run specific application and once opened need to click on specific place, can you pls help

Reply👍6👎6




@netherforager manage

thanks for the subscribe lol

Reply👍6👎6




@markusTegelane manage

Thank you! The tokens in the for command were incorrect, because I made this video with a different version of bg.exe that didn't detect which mouse button you pressed (so the output of "bg.exe mouse" looked something like 21 52, unlike the new version where it is 1 21 52). That is why you might actually get 21x1 as the coordinate in my script, even tough it's supposed to be 52x21.

Reply👍6👎6




@Ron55O manage

@markusTegelane You're welcome!

Reply👍7👎5




@saikumarsonti8709 manage

Hi I want to know how i can automate select/run specific application and once opened need to click on specific place, can you pls help

Reply👍6👎5




@Ron55O manage

Hi, @markustegelane! I found bugs in this little test program. Since you created this program in 2017, this command line may have changed a bit and it doesn't work well. Test.bat:<br /> <br /> @echo off<br /> setlocal EnableDelayedExpansion<br /> set "tab= "<br /> for /l %%a in (1,1,1000) do set "bck=!bck! "<br /> :screen<br /> echo %tab%%bck% 2>nul&set /p= <nul<br /> echo Click anywhere <br /> for /f "tokens=1- 3" %%a in ('bg.exe mouse') do set down=%%a&set right=%%b&set fol=%%c<br /> if %down% == 1 set down1=Left click<br /> if %down% == 2 set down1=Right click<br /> set key=%down1% %fol%x%right%<br /> cls<br /> echo %key%<br /> goto screen<br /> :anywhere<br /> echo %tab%%bck% 2>nul&set /p= <nul<br /> bg mouse >nul<br /> goto screen<br /> <br /> (I first saw this video in 2019, I just not very interested me the mouse in batch files.)

Reply👍9👎5




@markusTegelane manage

Thank you! The tokens in the for command were incorrect, because I made this video with a different version of bg.exe that didn't detect which mouse button you pressed (so the output of "bg.exe mouse" looked something like 21 52, unlike the new version where it is 1 21 52). That is why you might actually get 21x1 as the coordinate in my script, even tough it's supposed to be 52x21.

Reply👍6👎8




@Ron55O manage

@markusTegelane You're welcome!

Reply👍7👎4




@saikumarsonti8709 manage

Hi I want to know how i can automate select/run specific application and once opened need to click on specific place, can you pls help

Reply👍7👎6