Jump to content

Recommended Posts

Hi guys.

I used to have a driver before for my GIGABYTE mouse, which could set which button does what.

Now I changed to a new mouse, new brand, a noname ACME mouse.

This has no driver, no utility, nothing.

I'd like to write such a thing for myself, however I'm facing troubles. For redefining the meaning of any of the buttons, I have to block the real signal and send a custom one or something similar.

Basically the same as what HotkeySet does.

Simple _IsPressed won't do it's job, since it will only detect if it's currently pressed. At the moment I can't see any ways to do this task. Has anyone an idea how should I start, what to do?

Link to post
Share on other sites

Well,basically I want to assign different events to some of the mouse buttons. Let me show an example. Here is the driver I had:


I don't care about DPI and further settings, I just want to for example press left mouse click when I'm pressing the side (4th or 5th) buttons.

I hope you can understand now :)

Link to post
Share on other sites

#include <MouseTrapEvent.au3>
Global $hLastHotKeyPressed = ""
Global $hLastHotKeyType = ""

_HotKeySet("{RDCLICK}", "_ModifyLeft")
_HotKeySet("^e", "_Exit")
While 1

Func _ModifyLeft() ; user defined function for hot key
 If StringInStr(StringUpper($hLastHotKeyPressed), "RDCLICK") Then
  ;do some magic here
  ConsoleWrite("Last Hotkey pressed: " & $hLastHotKeyPressed & @LF)
EndFunc   ;==>_ModifyLeft

Func _HotKeySet($hotkey, $function, $block = 1)
 If $function = "" Or IsString($function) = False Then Return SetError(1)
 If StringInStr(StringUpper($hotkey), "CLICK") Then
  Dim $mouseHotKey ; local
  $mouseHotKey = $hotkey
  $mouseHotKey = StringReplace($mouseHotKey, "{", "")
  $mouseHotKey = StringReplace($mouseHotKey, "}", "")
  If $function = "" Then
   _MouseTrapEvent($mouseHotKey, $function, $block)
  HotKeySet($hotkey, $function)
EndFunc   ;==>_HotKeySet
Func UpDateHotKeys() ;
 Dim $hLastMouseEventPressed
 $hLastMouseEventPressed = __MouseTrapEvent_getLastMouseEventPressed()
 If $hLastMouseEventPressed <> "" Then
  $hLastHotKeyPressed = "{" & $hLastMouseEventPressed & "}"
  $hLastHotKeyType = "Mouse"
  $hLastHotKeyPressed = @HotKeyPressed
  $hLastHotKeyType = "Keyboard"
EndFunc   ;==>UpDateHotKeys
Func _Exit()
EndFunc   ;==>_Exit

For the interface of that pic you will have to deal with it by yourself ;)


Edited by AutID
Link to post
Share on other sites

Another way is using MrCreatoR's MouseOnEvent UDF. This however is a bit different but it has more features.

#include "..\MouseOnEvent.au3"
Global $iPrimary_DblClk_Event = 0
Global $iSecondary_DblClk_Event = 0
HotKeySet("{ESC}", "_Quit")
While 1
Func _DblClk_Event($iEvent)
 Switch $iEvent
   $iPrimary_DblClk_Event = 1
   $iSecondary_DblClk_Event = 1
Func _Quit()
Func _ModifyDoubleRightToLeft()
 If $iSecondary_DblClk_Event Then
  $iSecondary_DblClk_Event = 0
  ConsoleWrite("Left clicked!" & @LF)


Link to original post: '?do=embed' frameborder='0' data-embedContent>>


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