Alkerak Posted August 22, 2011 Posted August 22, 2011 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?
rcmaehl Posted August 22, 2011 Posted August 22, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
Alkerak Posted August 22, 2011 Author Posted August 22, 2011 (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 August 22, 2011 by Alkerak
rcmaehl Posted August 22, 2011 Posted August 22, 2011 (edited) Func Example() While 1 If _IsPressed("01") And _IsPressed("5B") Or _IsPressed("5C") Then MouseClick("Middle") WEnd EndFunc Edited August 22, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
Alkerak Posted August 22, 2011 Author Posted August 22, 2011 (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 August 22, 2011 by Alkerak
rcmaehl Posted August 22, 2011 Posted August 22, 2011 (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 August 22, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
Alkerak Posted August 22, 2011 Author Posted August 22, 2011 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.
rcmaehl Posted August 22, 2011 Posted August 22, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
Alkerak Posted August 23, 2011 Author Posted August 23, 2011 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!
smashly Posted August 23, 2011 Posted August 23, 2011 (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 August 23, 2011 by smashly
rcmaehl Posted August 23, 2011 Posted August 23, 2011 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 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF
AdmiralAlkex Posted August 23, 2011 Posted August 23, 2011 (edited) Jag känner en bot... 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 August 23, 2011 by Valik Removed link. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Blue_Drache Posted August 23, 2011 Posted August 23, 2011 (edited) Jag känner en bot... Shame on you. You should know better than to quote a spambot, you only perpetuate its links. Just report it and move along. Edited August 23, 2011 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Valik Posted August 23, 2011 Posted August 23, 2011 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.
AdmiralAlkex Posted August 23, 2011 Posted August 23, 2011 Still worth it .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now