Unc3nZureD Posted October 25, 2014 Share Posted October 25, 2014 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 comment Share on other sites More sharing options...
AutID Posted October 25, 2014 Share Posted October 25, 2014 You want to set your mouse buttons as hotkey using hotkeyset function or are you just searching for an utility that would do that, meaning it would create a shortcut for your mouse buttons..?! https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Unc3nZureD Posted October 25, 2014 Author Share Posted October 25, 2014 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 comment Share on other sites More sharing options...
AutID Posted October 25, 2014 Share Posted October 25, 2014 (edited) expandcollapse popup#include <MouseTrapEvent.au3> Global $hLastHotKeyPressed = "" Global $hLastHotKeyType = "" _HotKeySet("{RDCLICK}", "_ModifyLeft") _HotKeySet("^e", "_Exit") While 1 Sleep(10) WEnd Func _ModifyLeft() ; user defined function for hot key UpDateHotKeys() If StringInStr(StringUpper($hLastHotKeyPressed), "RDCLICK") Then ;do some magic here ConsoleWrite("Last Hotkey pressed: " & $hLastHotKeyPressed & @LF) EndIf 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) Else _MouseTrapEvent($mouseHotKey, $function, $block) EndIf Else HotKeySet($hotkey, $function) EndIf EndFunc ;==>_HotKeySet Func UpDateHotKeys() ; Dim $hLastMouseEventPressed $hLastMouseEventPressed = __MouseTrapEvent_getLastMouseEventPressed() If $hLastMouseEventPressed <> "" Then $hLastHotKeyPressed = "{" & $hLastMouseEventPressed & "}" $hLastHotKeyType = "Mouse" Else $hLastHotKeyPressed = @HotKeyPressed $hLastHotKeyType = "Keyboard" EndIf EndFunc ;==>UpDateHotKeys Func _Exit() Exit EndFunc ;==>_Exit For the interface of that pic you will have to deal with it by yourself MouseTrapEvent.au3 Edited October 25, 2014 by AutID https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
AutID Posted October 25, 2014 Share Posted October 25, 2014 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") _MouseSetOnEvent($MOUSE_SECONDARYDBLCLK_EVENT, '_DblClk_Event') While 1 _ModifyDoubleRightToLeft() Sleep(10) WEnd Func _DblClk_Event($iEvent) Switch $iEvent Case $MOUSE_PRIMARYDBLCLK_EVENT $iPrimary_DblClk_Event = 1 Case $MOUSE_SECONDARYDBLCLK_EVENT $iSecondary_DblClk_Event = 1 EndSwitch EndFunc Func _Quit() Exit EndFunc Func _ModifyDoubleRightToLeft() If $iSecondary_DblClk_Event Then $iSecondary_DblClk_Event = 0 ConsoleWrite("Left clicked!" & @LF) MouseClick("left") EndIf EndFunc Link to original post: '?do=embed' frameborder='0' data-embedContent>> MouseOnEvent.au3 https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
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