Guest User

Batch mouse tutorial

a guest
May 29th, 2017
3,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.14 KB | None | 0 0
  1. @echo off
  2. :: Turns echoing off
  3. setlocal EnableDelayedExpansion
  4. :: Allows effect variables with !! (in addition to $$ and %%) and makes for loops usuable
  5. set "tab=           "
  6. :: Sets varible that will be written on screen to avoid flicker
  7. for /l %%a in (1,1,1000) do set "bck=!bck!"
  8. :screen
  9. :: Sets backspace character that will be used to clear the text on screen
  10. echo %tab%%bck% 2>nul&set /p=<nul
  11. echo Click anywhere                        
  12. :: Clears screen for the computer, so it can overwrite the text
  13. for /f "tokens=1- 3" %%a in ('bg.exe mouse') do set down=%%a&set right=%%b
  14. :: Gets the input from the mouse (position)
  15. set key=%down%x%right%
  16. :: Sets the variable named %key% that will have mouse position data
  17. if "%key%"=="1x1" goto anywhere
  18. :: Checks the position variable and goes to some label called anywhere
  19. echo %key%            
  20. goto screen
  21. :: Goes to the main screen as nothing that goes to conditions was pressed
  22. :anywhere
  23. echo %tab%%bck% 2>nul&set /p=<nul
  24. echo You clicked where I wanted you to click
  25. bg mouse >nul
  26. :: Simply executing this command will have some kind of press any key to continue effect, but with mouse
  27. goto screen
Advertisement
Add Comment
Please, Sign In to add comment