Crista Posted October 12, 2009 Share Posted October 12, 2009 How I am new to this Autoit and I am trying to activate a function using MouseWheel up command but it doesnt work?HotKeySet("MouseWheel "up", "A")While 1 Sleep(50)WEndFunc A()Send("{ALTDOWN}")Sleep(30)MouseClick("left")Sleep(30)Send("{ALTUP}")EndFunc ;==>AI have tried googling this but with no result Could you help please? Link to comment Share on other sites More sharing options...
Enforcer Posted October 12, 2009 Share Posted October 12, 2009 Read autoit help about function _IsPressed maybe this will help... #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("04", $dll) Then A() EndIf WEnd DllClose($dll) Func A() Send("{ALTDOWN}") Sleep(30) MouseClick("left") Sleep(30) Send("{ALTUP}") EndFunc ;==>A ======== 01 Left mouse button 02 Right mouse button 04 Middle mouse button (three-button mouse) 05 Windows 2000/XP: X1 mouse button 06 Windows 2000/XP: X2 mouse button ======== I don't think that you can hook mouse wheel so simple like you did // HotKeySet("MouseWheelup", "A") [RU] Zone Link to comment Share on other sites More sharing options...
AndyG Posted October 12, 2009 Share Posted October 12, 2009 Hi, try this....guicreate("") GUIRegisterMsg(0x020A, "_Mousewheel") guisetstate() do sleep(50) until guigetmsg()=-3 Func _Mousewheel($hWnd, $msg, $l, $r) ;abfrage mausrad If $l = 0xFF880000 Then ; Mouse wheel up tooltip("Mousewheel up") Else ; Mouse wheel down tooltip("Mousewheel down") EndIf sleep (1000) tooltip("") EndFunc ;==>_Mousewheel Andy Link to comment Share on other sites More sharing options...
Enforcer Posted October 12, 2009 Share Posted October 12, 2009 (edited) Andy, I'm glad that exist's PROgrammers like u ) That can REALY help )) Edited October 12, 2009 by Enforcer [RU] Zone Link to comment Share on other sites More sharing options...
Crista Posted October 12, 2009 Author Share Posted October 12, 2009 (edited) Hi, try this....guicreate("") GUIRegisterMsg(0x020A, "_Mousewheel") guisetstate() do sleep(50) until guigetmsg()=-3 Func _Mousewheel($hWnd, $msg, $l, $r) ;abfrage mausrad If $l = 0xFF880000 Then ; Mouse wheel up tooltip("Mousewheel up") Else ; Mouse wheel down tooltip("Mousewheel down") EndIf sleep (1000) tooltip("") EndFunc ;==>_Mousewheel Andy Thanks you all for quick reply's, but where do I put all that?! When I run that macro a new Autoit window box opens but its all black? Edited October 12, 2009 by Crista Link to comment Share on other sites More sharing options...
AndyG Posted October 12, 2009 Share Posted October 12, 2009 (edited) Sorry, but this was only an example You have to replace your code into the function....but now i see, my Function only works when the window is activated. I am looking for a solution without any GUI, something with Hooks maybe^^. I will post it here if i find something..... Andy /*EDIT*/ ... If I had carefully read the first post, i had realized that not the WHEELUP (turning the Mousewheel) was mentioned, but the WHEELKLICK . Sorry.... But here is my Script using _WinAPI_SetWindowsHookEx() to catch a turning Mousewheel without any GUI and it hopefully does what Crista needs^^ expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <WinAPI.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> Opt('MustDeclareVars', 1) Global $hHook, $hStub_MouseProc, $buffer = "", $hmod $hStub_MouseProc = DllCallbackRegister("_MouseWheel", "long", "int;wparam;lparam") $hmod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_MouseProc), $hmod) While 1 Sleep(10) WEnd Func OnAutoItExit(); use it when exit ^^ _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_MouseProc) EndFunc ;==>OnAutoItExit Func _Mousewheel($nCode, $wParam, $lParam) ;abfrage mausrad ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $wParam = ' & $wParam & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ; look for the $wParam to get the number of the buttons switch $wparam case 522 ; Mouse wheel up/down , i dont know how to distinguish up and down tooltip("mousewheel turning...") ; sleep (1000) ;not good, better return this function as fast as possible tooltip("") case 516 ;~ tooltip("right mousebutton down...") ; ;~ sleep(1000) ;~ tooltip("") case 517 ;~ tooltip("right mousebutton up...") ; ;~ sleep(1000) ;~ tooltip("") case 519 ;mousewheelclick^^ Send("{ALTDOWN}") Sleep(30) MouseClick("left") Sleep(30) Send("{ALTUP}") endswitch Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc Edited October 12, 2009 by AndyG Link to comment Share on other sites More sharing options...
picea892 Posted October 12, 2009 Share Posted October 12, 2009 http://www.autoitscript.com/forum/index.php?showtopic=81761 Link to comment Share on other sites More sharing options...
Dim Posted July 2, 2010 Share Posted July 2, 2010 (edited) Func _Mousewheel($hWnd, $msg, $l, $r) ;abfrage mausrad Im confused how do I call these functions? what do i put in the params???????? Edited July 2, 2010 by Dim Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 2, 2010 Moderators Share Posted July 2, 2010 Dim,Welcome to the AutoIt forum. what do i put in the params?You put nothing there, Windows does it for you! GUIRegisterMsg and the message handling functions are not simple to understand. Try reading the tutorial in the Wiki and see if it all becomes clear.Come back and ask further questions if not. 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...
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