I am trying to find out how to move the mouse cursor N pixels to some direction.... through a command script, since I cannot install anything on my computer.
I basically try to keep the screen active forever, until I kill the script.
(Yes, I've been searching high and low for a way to do it by a command script.... but could not find anything. I hope it's possible.)
To move the cursor one word to the left, press Ctrl + LeftArrow .
Speed is ignored for SendInput/Play modes; they move the mouse instantaneously (though SetMouseDelay has a mode that applies to SendPlay).
The most straightforward way to manipulate mouse with batch file is with
rundll32 user32.dll,SetCursorPos
But this is not very useful - just sets the mouse to 0,0 position.
Check the mouse.bat - it is a self compiled C#/batch file and does not require external tools and the source is visible and editable.
Examples:
//clicks at the current position
call mouse click
//double clicks at the current position
call mouse doubleClick
//right clicks at the current position
call mouse rightClick
//returns the position of the cursor
call mouse position
//scrolls up the mouse wheel with 1500 units
call mouse scrollUp 150
//scrolls down with 100 postitions
call mouse scrollDown 100
//relatively(from the current position) moves the mouse with 100 horizontal and 100 vertial postitions
call mouse moveBy 100x100
//absolute positioning
call mouse moveTo 100x100
//relative drag (lefclick and move)
call mouse dragBy 300x200
//absolute drag
call mouse dragTo 500x500
Search for NirCmd, and install it in C:\windows, and do:
nircmd setcursor 100 50
nircmd movecursor 10 10
or another commands for clicks etc.
(Late answer but can still be useful for others) If you just want to keep your computer from falling asleep, the software "Caffeine" does this quite well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With