Search code examples
windowsbatch-filemousemovemouseclick-event

How can I move mouse cursor and click?


Like my question, how can I do it? I have started making a .bat file which will open websites and now I want it to move the cursor into a specific X'Y location of the screen and left click. Is there a way I can do it in .bat or in any other type of script?

Thanks in advance, -Stam


Solution

  • 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