Jump to content

[solved] disable/enable mouse


Go to solution Solved by jguinch,

Recommended Posts

My optical USB mouse sometimes refuses to work . Plug out / plug in the USB connector heals the problem.

Since my PC is located below the desk, it takes some sportive moments to do health care. :sweating:

I looked for a better solution and found that invoking system control panel for mouse and then deact/act the driver did the job.

So I've written a small script to do it for me:

;;~ reset mouse (does NOT work)
ShellExecute("main.cpl",",4")
WinWaitActive("[class:#32770]","",3)
Sleep(1000)
ControlClick("[class:#32770]","","Button2")
Sleep(1000)
ControlSend("[active]","", "","^{TAB}")
Sleep(1000)
ControlClick("[active]","","Button4")
Sleep(1000)
ControlSend("[active]","", "","{TAB}")
Sleep(5000) ; to check that selction before ENTER
ControlSend("[active]","", "","{ENTER}")
MsgBox(Default, Default, "Just try it yourself now ",3)

The dialog shows the same panels as the 'by hand' method.

But the click on the 'deactivate' and 'confirn' buttons have no effect. Strange. :x

How to disable and enable the mouse driver by a script ?

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

if the use of a little "external" utility is allowed then maybe you could use DevCon as explained here

.....else forget this post

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

if the use of a little "external" utility is allowed then maybe you could use DevCon as explained here

.....else forget this post

I tried DevCon.exe already with no success.

But nevertheless, thanks for your effort.

I don't know if you've already tried, but sometimes automatisation requires admin rights. Try #RequireAdmin

#RequireAdmin was also unrewarding. Again, thanks for your effort.

@ALL: Did you tried my code on your PC ? Same findings ?

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

If you have a x64 system you can't use the x86 version, it will not work. PM sent, the official way is to download the entire Windows Developer Kit for a couple of KB

Oh, and don't forget to run CMD as administrator

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

If you have a x64 system you can't use the x86 version, it will not work. PM sent, the official way is to download the entire Windows Developer Kit for a couple of KB

Oh, and don't forget to run CMD as administrator

Many thanks. Your PM'ed version works like a charm.

In the meantime I already downloaded and installed WDK.

I'll browse it and probably discard it soon.

But there is a question left: Why does my script does not work ? Any thoughts?

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

I might see your problem :) There are tons of [class:#32770] running on a windows machine. It's a common class, you need something unique. Try to replace it with the actual title. I think it should work.

As you can see from the screenshot, it is no problem with [class:#32770]

post-45639-0-20918700-1400517683_thumb.j

Did you run the script?

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

This script now makes the job:

;~ reset mouse
RunWait('"' & @ComSpec & '" /c ' &@UserProfileDir& '\Data\Software\DevCon\devcon\devcon_x64\devcon.exe disable *mouse*', '', @SW_HIDE)
RunWait('"' & @ComSpec & '" /c ' &@UserProfileDir& '\Data\Software\DevCon\devcon\devcon_x64\devcon.exe enable *mouse*', '', @SW_HIDE)

But the script from first post refuses to do the job. Strange !

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...