Jump to content

Emulating Middle click by left+right click?


Recommended Posts

Hello,

I am in a peculiar situation. I do a lot of work in AutoCAD and Sketchup; both of which have a huge dependancy on the middle button. Recently I purchased an iMac I have been trying to find a way to make the magic mouse emulate a middle click. Let me clarify that I prefer to work on CAD programes in the windows emvironment via bootcamp.

Now on iOS there is magicprefs, which beautifully manages to give a middle click, but there is nothing like it on the windows platform.

What I thought was that I could use AutoIt for emulating the middle click by clicking the left+right buttons simultaneously; but after going thro the help file and the reference I find that I am completely out of my depth as far as coding is concerned, although I am guessing that for someone who would know the proper usage of AutoIt it might be simple.

I am using windows 7 64 bit.

So, if someone can help me with this I would be very grateful.

Thanks,

flyashy

Link to post
Share on other sites

Wouldn't it be easier to just buy a mouse with a scroll wheel? They will work on Macs.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

Ah, yes. It would certainly be easier.

But thanks to apple's blatant disregard for the middle click :thumbsdown: a lot of people are facing the same issue (what I gleaned from trying to find a solution to my issue).

Also magic mouse does have it's advantages probably in the aesthetic areas. ^_^

I've noticed that both the apple keyboard & mouse function better because they work on bluetooth instead of wi-fi, (since there are so many gadgets using the 2.4Ghz which continually cause interfernce).

I have previously used AutoHotKey to make a couple of kbd scripts but it has it's limitations.

If such a script can be made it'd not only help me but other too who are stuck with the magicmouse+windows+CAD combination.

Regards,

flyashy

Link to post
Share on other sites

Isn't that problem only on the OS X side of the machine? The Windows OS should recognize the middle mouse button, unless the hardware of the Mac you're using doesn't allow it, which I don't see as being an issue.

Actually, something like this would work on the Windows OS. You'll have to tweak it for your needs, but this is only a demo. Use it with something like a browser to test it.

#include <Misc.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
     If _IsPressed("01", $hDLL) And _IsPressed("02", $hDLL) Then ; mouse left and right pressed
          ConsoleWrite("!_IsPressed - Both mouse buttons pressed." & @CRLF)
          ; Wait until key is released.
          ControlClick("", "", "", "middle", 1)
          While _IsPressed("01", $hDLL) And _IsPressed("02", $hDLL) ; one of the buttons was released
               Sleep(250)
          WEnd
          ConsoleWrite(">_IsPressed - Mouse button(s) released." & @CRLF)
     ElseIf _IsPressed("1B", $hDLL) Then
          MsgBox(0, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.", 3)
          ExitLoop
     EndIf
     Sleep(250)
WEnd

DllClose($hDLL)
Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...