MattHiggs Posted April 20, 2017 Share Posted April 20, 2017 (edited) So I would like to write a script that will perform a certain action when the script detects that the mouse wheel has been scrolled up or down, but not pressed. I would like it to work in much the same way that a script would perform a certain action when a key is pressed: #include <Misc.au3> Do Sleep ( 250 ) Until _IsPressed (04) ;do stuff here But instead of waiting for the middle mouse button to be pressed, script would wait until it detects it has been scrolled. Any thoughts on how to accomplish this? Edited April 20, 2017 by whiggs2 Link to comment Share on other sites More sharing options...
Xandy Posted April 20, 2017 Share Posted April 20, 2017 (edited) First have a look here and download the UDF or whatever. Set some functions to flag variables. Name the functions any valid function name. I have kept the misspelling from the tutorial. ;mouse event functions Func MOUSE_WHELLSCROLL_DOWN() ConsoleWrite(@CRLF & "!MOUSE WHEEL DOWN") $gMb_wheel_down = 1 EndFunc;MOUSE_WHELLSCROLL_DOWN() Func MOUSE_WHELLSCROLL_UP() ConsoleWrite(@CRLF & "!MOUSE WHEEL UP") $gMb_wheel_up = 1 EndFunc;MOUSE_WHELLSCROLL_UP() Assign those functions to be called on mouse wheel up | down. You might have to do this after you create a GUI window Idk. _MouseSetOnEvent_RI($MOUSE_WHEELSCROLLUP_EVENT, "MOUSE_WHELLSCROLL_UP", $hGui) _MouseSetOnEvent_RI($MOUSE_WHEELSCROLLDOWN_EVENT, "MOUSE_WHELLSCROLL_DOWN", $hGui) Now you can check the variables to test for true. If true, switch them back off and maybe do some action. If $gMb_wheel_up = 1 Then $gMb_wheel_up = 0 Exit EndIf Edited April 20, 2017 by Xandy MattHiggs 1 Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
MattHiggs Posted April 20, 2017 Author Share Posted April 20, 2017 8 minutes ago, Xandy said: First have a look here and download the UDF or whatever. Set some functions to flag variables. Name the functions any valid function name. I have kept the misspelling form the tutorial. ;mouse event functions Func MOUSE_WHELLSCROLL_DOWN() ConsoleWrite(@CRLF & "!MOUSE WHEEL DOWN") $gMb_wheel_down = 1 EndFunc;MOUSE_WHELLSCROLL_DOWN() Func MOUSE_WHELLSCROLL_UP() ConsoleWrite(@CRLF & "!MOUSE WHEEL UP") $gMb_wheel_up = 1 EndFunc;MOUSE_WHELLSCROLL_UP() Assign those functions to be called on mouse wheel up | down. _MouseSetOnEvent_RI($MOUSE_WHEELSCROLLUP_EVENT, "MOUSE_WHELLSCROLL_UP", $hGui) _MouseSetOnEvent_RI($MOUSE_WHEELSCROLLDOWN_EVENT, "MOUSE_WHELLSCROLL_DOWN", $hGui) Now you can check the variables to test for true. If true, switch them back off and maybe do some action. If $gMb_wheel_up = 1 Then $gMb_wheel_up = 0 Exit EndIf Exactly what I needed. You are a gentleman and a scholar. Link to comment Share on other sites More sharing options...
Xandy Posted April 20, 2017 Share Posted April 20, 2017 Quote You are a gentleman and a scholar. I try so hard. mikell and MattHiggs 2 Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) 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