jacky998877 Posted March 11, 2021 Share Posted March 11, 2021 (edited) I want it to pop up a message when I roll the mouse wheel button up and down, here is the script $wheelclick = 1 & 0 $movewheel = "down" & "up" MouseWheel($movewheel,$wheelclick) While 1 If $movewheel = "down" & $wheelclick = 1 Then ToolTip("down", 0, 0) ElseIf $movewheel = "up" & $wheelclick = 1 Then ToolTip("up", 0, 0) EndIf WEnd Edited March 11, 2021 by jacky998877 Link to comment Share on other sites More sharing options...
lIlIIlIllIIIIlI Posted March 11, 2021 Share Posted March 11, 2021 (edited) you are assigning $wheelclick the string '10' ( '&' is for joining things together as strings ) likewise for $movewheel, you assign it the string 'downup' MouseWheel() only moves the mouse wheel, if you provide the right parameters. (see https://www.autoitscript.com/autoit3/docs/functions/MouseWheel.htm ) however it doesn't provide output of the mousewheel position in your While loop, nothing alters the values of $movewheel or $wheelclick, and both If/ElseIf statements are false at the start of the loop so the Tooltip() in both will never be reached those are just some mistakes. you need to find a UDF on the forum for detecting mousewheel events perhaps, i don't know how to do that Edited March 11, 2021 by lIlIIlIllIIIIlI Link to comment Share on other sites More sharing options...
jacky998877 Posted March 11, 2021 Author Share Posted March 11, 2021 1 hour ago, lIlIIlIllIIIIlI said: you are assigning $wheelclick the string '10' ( '&' is for joining things together as strings ) likewise for $movewheel, you assign it the string 'downup' MouseWheel() only moves the mouse wheel, if you provide the right parameters. (see https://www.autoitscript.com/autoit3/docs/functions/MouseWheel.htm ) however it doesn't provide output of the mousewheel position in your While loop, nothing alters the values of $movewheel or $wheelclick, and both If/ElseIf statements are false at the start of the loop so the Tooltip() in both will never be reached those are just some mistakes. you need to find a UDF on the forum for detecting mousewheel events perhaps, i don't know how to do that I think the "UDF file" idea is reasonable, before i do anything it will do it for me , some detecting mechanism is needed, and the rest of the idea you have mentioned i need time to process them 😃 Link to comment Share on other sites More sharing options...
Musashi Posted March 11, 2021 Share Posted March 11, 2021 (edited) 2 hours ago, jacky998877 said: I want it to pop up a message when I roll the mouse wheel button up and down, here is the script ... @lIlIIlIllIIIIlI has already addressed some bugs in your script and recommended to search for an existing solution. @jacky998877 : You're probably looking for something like this : expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _Example() ; _Example Func _Example() GUICreate("My GUI", 640, 480, 50, 50) ; will create a dialog box that when displayed is centered GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL") GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN Sleep(250) ToolTip("") EndSwitch WEnd GUIDelete() EndFunc ;==>_Example Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) Local $iMPos = MouseGetPos() Switch $wParam Case 0x00780000 ToolTip("Mouse wheel UP is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Wheel UP", 1, 3) Case 0xFF880000 ToolTip("Mouse wheel Down is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Wheel Down", 1, 3) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_MOUSEWHEEL (Origin : is-it-possible-to-detect-the-mouse-whee-move by @JScript ) Edited March 11, 2021 by Musashi typo "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 11, 2021 Moderators Share Posted March 11, 2021 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jacky998877 Posted March 11, 2021 Author Share Posted March 11, 2021 (edited) @Musashi i studied the script you have provided , it can open a exe file by rolling the wheel ,but it must depend on a gui, if the gui is deleted the whole script will not work Edited March 11, 2021 by Melba23 Removed quote Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 11, 2021 Moderators Share Posted March 11, 2021 jacky998877, When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jacky998877 Posted March 11, 2021 Author Share Posted March 11, 2021 @Melba23 , agreed Link to comment Share on other sites More sharing options...
Musashi Posted March 11, 2021 Share Posted March 11, 2021 1 hour ago, jacky998877 said: it can open a exe file by rolling the wheel ,but it must depend on a gui, if the gui is deleted the whole script will not work Then I recommend you to take a look at the mouseonevent-udf made by @MrCreatoR . There you will also find various example scripts. Here is an approach of mine (created on the fly) . #include <MouseOnEvent.au3> HotKeySet("{ESC}", "_Terminate") $hGUI = WinGetHandle("") _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "MOUSE_WHELLSCROLL_UP", "", "", $hGUI) _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "MOUSE_WHELLSCROLL_DOWN", "", "", $hGUI) While True Sleep(100) WEnd Func MOUSE_WHELLSCROLL_UP() Local $iMPos = MouseGetPos() ToolTip("Mouse wheel UP is detected!" & @CRLF, $iMPos[0], $iMPos[1], "Wheel UP", 1, 3) Sleep (2000) ToolTip("") EndFunc Func MOUSE_WHELLSCROLL_DOWN() Local $iMPos = MouseGetPos() ToolTip("Mouse wheel Down is detected!" & @CRLF, $iMPos[0], $iMPos[1], "Wheel Down", 1, 3) Sleep (2000) ToolTip("") EndFunc Func _Terminate() ToolTip("") Exit EndFunc ;==>_Terminate "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
jacky998877 Posted March 11, 2021 Author Share Posted March 11, 2021 @ Musashi , thanks for your effort 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