Sign in to follow this  
Followers 0

Simulate Middle Mouse Click

15 posts in this topic

#1 ·  Posted

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted

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.

Current Projects:

IRC UDF, for IRC activities

[u]SafeExecute[/u], for picking and choosing what commands you want Execute to be able to run.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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.

Current Projects:

IRC UDF, for IRC activities

[u]SafeExecute[/u], for picking and choosing what commands you want Execute to be able to run.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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.

Current Projects:

IRC UDF, for IRC activities

[u]SafeExecute[/u], for picking and choosing what commands you want Execute to be able to run.

Share this post


Link to post
Share on other sites

#7 ·  Posted

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.

Share this post


Link to post
Share on other sites

#8 ·  Posted

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.

Current Projects:

IRC UDF, for IRC activities

[u]SafeExecute[/u], for picking and choosing what commands you want Execute to be able to run.

Share this post


Link to post
Share on other sites

#9 ·  Posted

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!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#11 ·  Posted

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.

Current Projects:

IRC UDF, for IRC activities

[u]SafeExecute[/u], for picking and choosing what commands you want Execute to be able to run.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#14 ·  Posted

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.

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