hellfire03 Posted January 17, 2011 Share Posted January 17, 2011 (edited) hello i am new here but i write some scripts now i am trying to write script that run in the background and do that my mouse will be multimedia mouse i mean that the buttons do thing like vol up, vol down, next item in the playlist, pause etc... i want :next, prev, pause, vol up, vol down so i need 5 buttons i have horizontal and vertical scrolling left button right button and side button i can detect the side left right and the wheel but i can detect the scrolling of the wheel i see _ispressed but there is no scrolling detection i search something like "_WinAPI_Mouse_Event" but reversed (i don't want not to send event i want to catch\handle\detect event) thank you, Arye (sorry about the English - i hope the i don't have a lot of mistakes) Edited January 17, 2011 by hellfire03 Link to comment Share on other sites More sharing options...
JohnOne Posted January 17, 2011 Share Posted January 17, 2011 Try AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Mat Posted January 17, 2011 Share Posted January 17, 2011 Heres the most simple example, which just gets up or down scroll... Read this page for other uses of wParam and lParam. If you haven't used GUIRegisterMsg before then I'd recommend reading the tutorial on the wiki.#include<WinAPI.au3> #include<WindowsConstants.au3> Global Const $WHEEL_DELTA = 120 Global $hGUI $hGUI = GUICreate("Test Wheel") GUISetState() GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case -3 ExitLoop EndSwitch WEnd Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) $iLen = _WinAPI_HiWord($wParam) / $WHEEL_DELTA If $iLen > 0 Then ConsoleWrite("Scrolled up " & $iLen & @LF) Else ConsoleWrite("Scrolled down " & Abs($iLen) & @LF) EndIf EndFunc ;==>WM_MOUSEWHEEL AutoIt Project Listing Link to comment Share on other sites More sharing options...
hellfire03 Posted January 17, 2011 Author Share Posted January 17, 2011 Trythank you very much! Link to comment Share on other sites More sharing options...
guinness Posted January 17, 2011 Share Posted January 17, 2011 Nice Example Mat! Added to my Function Folder UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Mat Posted January 17, 2011 Share Posted January 17, 2011 Nice Example Mat! Added to my Function Folder Here's a more complete example: expandcollapse popup#include<WinAPI.au3> #include<WindowsConstants.au3> Global Const $WHEEL_DELTA = 120 Global Const $MK_LBUTTON = 0x1 Global Const $MK_RBUTTON = 0x2 Global Const $MK_SHIFT = 0x4 Global Const $MK_CONTROL = 0x8 Global Const $MK_MBUTTON = 0x10 Global Const $MK_XBUTTON1 = 0x20 Global Const $MK_XBUTTON2 = 0x40 Global $hGUI $hGUI = GUICreate("WM_MOUSEWHEEL (Full)") GUISetState() GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case -3 ExitLoop EndSwitch WEnd Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iLen = _WinAPI_HiWord($wParam) / $WHEEL_DELTA Local $iKeys = _WinAPI_LoWord($wParam) Local $iX = _WinAPI_LoWord($lParam) Local $iY = _WinAPI_HiWord($lParam) Local $sDir If $iLen > 0 Then $sDir = "up" Else $sDir = "down" $iLen = Abs($iLen) EndIf Local $sKeys = "" If BitAND($iKeys, $MK_CONTROL) = $MK_CONTROL Then $sKeys &= "CONTROL & " If BitAND($iKeys, $MK_LBUTTON) = $MK_LBUTTON Then $sKeys &= "LBUTTON & " If BitAND($iKeys, $MK_MBUTTON) = $MK_MBUTTON Then $sKeys &= "MBUTTON & " If BitAND($iKeys, $MK_RBUTTON) = $MK_RBUTTON Then $sKeys &= "RBUTTON & " If BitAND($iKeys, $MK_SHIFT) = $MK_SHIFT Then $sKeys &= "SHIFT & " If BitAND($iKeys, $MK_XBUTTON1) = $MK_XBUTTON1 Then $sKeys &= "XBUTTON1 & " If BitAND($iKeys, $MK_XBUTTON2) = $MK_XBUTTON2 Then $sKeys &= "XBUTTON2 & " If $sKeys = "" Then $sKeys = "No keys" Else $sKeys = StringTrimRight($sKeys, 3) EndIf ConsoleWrite(StringFormat("Scrolled %s %d with %s pressed at (%d, %d).\n", $sDir, $iLen, $sKeys, $iX, $iY)) ; Return 0 ; If you return zero, then the message will not be sent to any more windows. EndFunc ;==>WM_MOUSEWHEEL AutoIt Project Listing Link to comment Share on other sites More sharing options...
guinness Posted January 17, 2011 Share Posted January 17, 2011 Brilliant! I am sure I will find some use for the MouseWheel soon UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
wakillon Posted January 17, 2011 Share Posted January 17, 2011 A MouseOnEvent example.#include <MouseOnEvent.au3> $hGUI = WinGetHandle("") _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "MOUSE_WHELLSCROLL_UP", "", "", $hGUI) _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "MOUSE_WHELLSCROLL_DOWN", "", "", $hGUI) While 1 Sleep(100) WEnd Func MOUSE_WHELLSCROLL_UP() ConsoleWrite("UP" & @CR) EndFunc Func MOUSE_WHELLSCROLL_DOWN() ConsoleWrite("DOWN" & @CR) EndFunc AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
hellfire03 Posted January 18, 2011 Author Share Posted January 18, 2011 i want to understand: _MouseSetOnEvent,_ispressed and hotkeyset catch the event or detect? (if i click ALT autoit see it and do something and the OS get the ALT or autoit catch the event and stop it from get to the OS) thank you Link to comment Share on other sites More sharing options...
wakillon Posted January 18, 2011 Share Posted January 18, 2011 i want to understand:_MouseSetOnEvent,_ispressed and hotkeyset catch the event or detect?(if i click ALT autoit see it and do something and the OS get the ALT or autoit catch the event and stop it from get to the OS)thank youThose Functions detects events without disturbing your OS, you can also create your own combinations ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Mat Posted January 18, 2011 Share Posted January 18, 2011 _IsPressed detects, HotkeySet captures (But it must be a hotkey!) and I'm not sure about _MouseSetOnEvent though. To get more control you'd need to use a keyboard hook (search the forum). AutoIt Project Listing 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