Jump to content

Simulate Middle Mouse Click


Recommended Posts

Hello

I am using Maya 2012 with a magic mouse but I cannot be productive due to lack of a middle mouse button. I am no coder but an artist.

I just want to disable the Command Key for good and use it to simulate a middle mouse button click with Command + LMouseButton. I want this to be in a sort of loop ... (except the disableing part).

Can anyone help me?

Link to comment
Share on other sites

Func Example()
While 1
If _IsPressed("11", user32.dll) Then MouseClick("Middle")
WEnd
EndFunc

Like that ^?

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Func Example()
While 1
If _IsPressed("11", user32.dll) Then MouseClick("Middle")
WEnd
EndFunc

Like that ^?

Well, it actually did not work.

I removed the "user32.dll" bit and it started working, however ctrl + left mouse did not work panning in maya. I wanted to use the "Command" key which is mapped to "Windows" key.

Edited by Alkerak
Link to comment
Share on other sites

Func Example()
While 1
If _IsPressed("01") And _IsPressed("5B") Or _IsPressed("5C") Then MouseClick("Middle")
WEnd
EndFunc

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Func Example()
While 1
If _IsPressed("01") And _IsPressed("5B") Or _IsPressed("5C") Then MouseClick("Middle")
WEnd
EndFunc

Well, I compile the script, make it an exe, run it as an admin on my Win7 x64 but nothing happends. I press the Windows Key, Mouse Left Button, click, drag, nothing, every combination ...

I also when I run it I dont see the test.exe in the task manager.

Edited by Alkerak
Link to comment
Share on other sites

Try:

#include <misc.au3>
Example()

Func Example()
While 1
If _IsPressed("01") And (_IsPressed("5B") Or _IsPressed("5C")) Then MouseClick("Middle")
Sleep(500)
WEnd
EndFunc

EDIT: Added Rest In Script

EDIT EDIT: Corrected AND OR ordering

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Well, it works in a certain way ... it's like issuing rapid middle mouse clicks. But I need to hold alt + MMB, so when I do CMD + ALT + MMB nothing works ...

Not to mention it takes around 50% of my CPU's which is killer.

Link to comment
Share on other sites

Well, it works in a certain way ... it's like issuing rapid middle mouse clicks. But I need to hold alt + MMB, so when I do CMD + ALT + MMB nothing works ...

Not to mention it takes around 50% of my CPU's which is killer.

I believe I fixed the script, see the edited post above.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

I believe I fixed the script, see the edited post above.

Sort of works except it's a little slugish.

But I found a hiddent feature deep into the mel script files that controlls the settings. It's a controll that lets you choose the number of buttons, apparently it does not have a GUI frontend, but works nonetheless.

Thanks for all your time and help ... if only more programmers would be so prompt like you!

Link to comment
Share on other sites

Hi,

The sluggish part is the Sleep(500), The choppy part is using MouseClick.

Try MouseDown and MouseUp only when conditions are met, it may be more to your needs.

#include <Misc.au3>

Global $iFlag = 0

While Not _IsPressed("1B") ;Esc to quit
    If _IsPressed("01") And (_IsPressed("5B") Or _IsPressed("5C")) And Not $iFlag Then
        $iFlag = MouseDown("Middle")
    ElseIf Not _IsPressed("01") And (Not _IsPressed("5B") Or Not _IsPressed("5C")) And $iFlag Then
        $iFlag = (MouseUp("Middle") <> 1)
    EndIf
    Sleep(20)
WEnd

Cheers

Edited by smashly
Link to comment
Share on other sites

Hi,

The sluggish part is the Sleep(500), The choppy part is using MouseClick.

Try MouseDown and MouseUp only when conditions are met, it may be more to your needs.

Didn't see a MouseDown/MouseUp in the Docs :mellow: I probably need to do a refresher read of them, but your fix helps me too because it's more reliable and is a single click instead of multiple.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

Jag känner en bot...

:mellow:

Look at me I'm an idiot and quoted a spam bot so Valik had to edit my post to remove the link. Go me! - Valik

Edited by Valik
Removed link.
Link to comment
Share on other sites

Jag känner en bot...

:mellow:

Shame on you. You should know better than to quote a spambot, you only perpetuate its links. Just report it and move along.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Shame on you. You should know better than to quote a spambot, you only perpetuate its links. Just report it and move along.

Well said, his post has been edited to express how I feel about people when they quote spam bots.

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...