Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Simulate Middle Mouse Click


  • Please log in to reply
14 replies to this topic

#1 Alkerak

Alkerak

    Seeker

  • Active Members
  • 5 posts

Posted 22 August 2011 - 09:26 PM

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?







#2 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 671 posts

Posted 22 August 2011 - 09:31 PM

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


Like that ^?

Making dumb decisions and posting without thinking since August 7, 2011. Jury-rigging AutoIt to work how I want successfully since a while.

 

Current Projects:

IRC UDF, for IRC activities

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


#3 Alkerak

Alkerak

    Seeker

  • Active Members
  • 5 posts

Posted 22 August 2011 - 09:47 PM

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, 22 August 2011 - 09:52 PM.


#4 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 671 posts

Posted 22 August 2011 - 10:13 PM

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

Edited by rcmaehl, 22 August 2011 - 10:13 PM.

Making dumb decisions and posting without thinking since August 7, 2011. Jury-rigging AutoIt to work how I want successfully since a while.

 

Current Projects:

IRC UDF, for IRC activities

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


#5 Alkerak

Alkerak

    Seeker

  • Active Members
  • 5 posts

Posted 22 August 2011 - 10:24 PM

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, 22 August 2011 - 10:26 PM.


#6 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 671 posts

Posted 22 August 2011 - 10:29 PM

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, 22 August 2011 - 10:58 PM.

Making dumb decisions and posting without thinking since August 7, 2011. Jury-rigging AutoIt to work how I want successfully since a while.

 

Current Projects:

IRC UDF, for IRC activities

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


#7 Alkerak

Alkerak

    Seeker

  • Active Members
  • 5 posts

Posted 22 August 2011 - 10:40 PM

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.

#8 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 671 posts

Posted 22 August 2011 - 11:01 PM

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.

Making dumb decisions and posting without thinking since August 7, 2011. Jury-rigging AutoIt to work how I want successfully since a while.

 

Current Projects:

IRC UDF, for IRC activities

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


#9 Alkerak

Alkerak

    Seeker

  • Active Members
  • 5 posts

Posted 23 August 2011 - 12:19 AM

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!

#10 smashly

smashly

  • Active Members
  • PipPipPipPipPipPip
  • 1,636 posts

Posted 23 August 2011 - 01:06 AM

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, 23 August 2011 - 01:21 AM.


#11 rcmaehl

rcmaehl

    No where near a noob nor a pro coder.

  • Active Members
  • PipPipPipPipPipPip
  • 671 posts

Posted 23 August 2011 - 11:27 AM

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.

Making dumb decisions and posting without thinking since August 7, 2011. Jury-rigging AutoIt to work how I want successfully since a while.

 

Current Projects:

IRC UDF, for IRC activities

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


#12 AdmiralAlkex

AdmiralAlkex

    Here be dragons

  • Active Members
  • PipPipPipPipPipPip
  • 4,607 posts

Posted 23 August 2011 - 12:00 PM

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, 23 August 2011 - 04:29 PM.
Removed link.


#13 Blue_Drache

Blue_Drache

    Revolutionary Flavour

  • Active Members
  • PipPipPipPipPipPip
  • 3,467 posts

Posted 23 August 2011 - 03:40 PM

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, 23 August 2011 - 03:42 PM.

Lofting the cyberwinds on teknoleather wings, I am...The Blue DrachePosted ImagePosted Image

#14 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 23 August 2011 - 04:29 PM

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.

#15 AdmiralAlkex

AdmiralAlkex

    Here be dragons

  • Active Members
  • PipPipPipPipPipPip
  • 4,607 posts

Posted 23 August 2011 - 04:47 PM

Still worth it :mellow:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users