Sign in to follow this  
Followers 0
BlackEvil

USB Mouse

13 posts in this topic

Hi

How to use an USB mouse with the AutoIt scripts?

My script works only if it is a non-usb mouse ;):)

Share this post


Link to post
Share on other sites



Strange problem. Can has reproducer?

Windows should handle the mouse input correctly, AutoIt does nothing hardware specific (maybe your script does?).

Share this post


Link to post
Share on other sites

Strange problem. Can has reproducer?

Windows should handle the mouse input correctly, AutoIt does nothing hardware specific (maybe your script does?).

My script does nothing hardware specific as far as I know. :)

My script never worked in a usb mouse but always fine in PS/2. Btw is there any dependency with registry values of USB store? I am in a corporate network where the USB is disabled.

Share this post


Link to post
Share on other sites

Does your USB mouse even work at all if USB is disabled?

Yes of-course. That is why I am so much confused.

Share this post


Link to post
Share on other sites

To be honest, I am confused too. There must be something else causing your problem, because I would say the vast majority of AutoIt user base is using a PS/2 mouse, also.

Can you maybe write a reproducer script? Say what OS you have, your AutoIt version, etc.. We can try to reproduce the circumstances of your machine, and see if we get the same problem.

Share this post


Link to post
Share on other sites

I am using AutoIT v3.3.0.0.

My browser is IE6. I need to move the mouse to the centre of the screen. I am using this code for it.

WinSetState("Login - Windows Internet Explorer", "", @SW_MAXIMIZE)
    WinWaitActive("Login - Windows Internet Explorer", "")
    MouseClick("primary", @DesktopWidth/2, @DesktopHeight/2 , 4, 0)
    Send("{TAB}")
    Send("{ENTER}") ;Login using keyboard controls

My OS is XP SP3

Share this post


Link to post
Share on other sites

I am using AutoIT v3.3.0.0.

My browser is IE6. I need to move the mouse to the centre of the screen. I am using this code for it.

WinSetState("Login - Windows Internet Explorer", "", @SW_MAXIMIZE)
    WinWaitActive("Login - Windows Internet Explorer", "")
    MouseClick("primary", @DesktopWidth/2, @DesktopHeight/2 , 4, 0)
    Send("{TAB}")
    Send("{ENTER}") ;Login using keyboard controls

My OS is XP SP3

That's been done a few thousand times ...

Try this script and see if works.. :)

MouseClick("Left", 0, 0, 1, 10)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

That will ruin the script if the user has left handed mouse. Any way I will give a try for it and let you know the results. I am out of office now. Let me do it tomorrow :)

Btw why do you guess that could solve the issue? AutoIt has support for 'primary' as well as 'main' button right? Does this a old syntax?

;) I checked this in my home PC and all of them works as expected. But here the USB drive is enabled. I don'y have the script to disable the USB B)

MouseClick("Primary", @DesktopWidth/2,@DesktopHeight/2,2,100)
MsgBox(0, "Primary", "Primary")
MouseClick("main", @DesktopWidth/4,@DesktopHeight/4,2,100)
MsgBox(0, "Script", "main")
MouseClick("Left", @DesktopWidth/3,@DesktopHeight/3,100)
MsgBox(0, "Script", "Left")
Edited by BlackEvil

Share this post


Link to post
Share on other sites

Btw why do you guess that could solve the issue? AutoIt has support for 'primary' as well as 'main' button right? Does this a old syntax?

No, I think that the rest of your script logic is wrong and that it never gets to the line that has the MouseClick function on it. That's why I suggest testing the command specifically, outside of the script context, so we can confirm that mouse operations are actually working and focus on the rest of your script.

Share this post


Link to post
Share on other sites

I think that the rest of your script logic is wrong

I have the entire script running as expected in PC with PS/2 mouse. Problem is only with machines with USB mouse (to be specific: only in USB drive disabled machines) I tested the code in my home PC (USB Drive enabled)and it works fine.

Share this post


Link to post
Share on other sites

Instead of "primary" using "main" in MouseClick() will solve the issue.

Thank you for the idea!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0