kcvinu Posted July 14, 2015 Posted July 14, 2015 I hope you will make keyboard hook udf next. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Iczer Posted July 14, 2015 Posted July 14, 2015 i have some troubles with using MouseSetOnEvent udf in x64 script - after mouse clicks it always crush with "AutoIt3.exe ended.rc:128"#AutoIt3Wrapper_UseX64=Y #include "MouseOnEvent.au3" $Form1 = GUICreate("some gui", 333, 222, @DesktopWidth/2-175, @DesktopHeight/2-111) $Input1 = GUICtrlCreateInput("some text", 8, 8, 921, 21) GUISetState(@SW_SHOW) _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, '_DblClk_Event') While 1 Sleep(10) WEnd _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT)is there a some fix for it?bump... i mean i hope someone will help me make MouseSetOnEvent udf work in x64 script...
guinness Posted July 14, 2015 Posted July 14, 2015 I believe @MrCreatoR is aware of the issue. 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
MrCreatoR Posted August 10, 2015 Author Posted August 10, 2015 (edited) Update...v2.0 [08.08.2015]* Script breaking version!* Dropped AutoIt 3.3.6.1 - 3.3.8.1 support.* Added alternative _MouseSetOnEvent_RI function using Raw Input Data instead of mouse hook. !!! This function does not support $iBlockDefProc.* Added support for XBUTTON2 detection. Use $MOUSE_XBUTTON2DOWN_EVENT, $MOUSE_XBUTTON2UP_EVENT, and $MOUSE_XBUTTON2DBLCLK_EVENT constants to separate between XBUTTON and XBUTTON2.* Cosmetic changes in the UDF code. Edited August 10, 2015 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
MrCreatoR Posted August 12, 2015 Author Posted August 12, 2015 Update...v2.1 [12.08.2015]* Now if $iBlockDefProc is 0 (or when using _MouseSetOnEvent_RI), user function $sFuncName called by PostMessage to prevent issues with hook (or WM_* message) stoppage.* Cosmetic code changes.* Docs updated. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
MrCreatoR Posted August 13, 2015 Author Posted August 13, 2015 Another small update...v2.2 [13.08.2015]* AutoIt 3.3.6.1 - 3.3.8.1 supported again.* Code improvements and cosmetic changes. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Guest Posted October 28, 2015 Posted October 28, 2015 (edited) ThanksI use this UDF to make software fix to hardware problem in my mouse. The script solved my problem#include <GUIConstantsEx.au3>#include "MouseOnEvent.au3";HotKeySet("{ESC}", "_Quit")Global $g_cliked_timer = TimerInit()_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event")While Sleep(1000)WEnd Func _MousePrimaryDown_Event() Local $Output If TimerDiff($g_cliked_timer) < 250 Then $Output = 1 $g_cliked_timer = TimerInit() Return $OutputEndFunc Func _Quit() ExitEndFunc EDIT:I have problem with this.After a while, the script starts to eat a lot of CPU and it uses 25% all the time.My hardware problem in the mouse is that many times when I click once on the left button, the mouse "think" that I did double click (because something is wrong in the button)This code I wrote works and solve it most of the times.The point is that this double click is super super fast.. In fact, it is so fast that sometimes the script is not fast enough to block the second click. and and maybe that's what makes this bug (the 25% CPU)The script keeps do it's job even when this bug Happens. But I can not live with this 25% CPU usage.Please fix it Edited October 29, 2015 by Guest
MrCreatoR Posted October 29, 2015 Author Posted October 29, 2015 I have problem with this.You are using the latest version of this UDF?Because i have no problem as you described. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
MrCreatoR Posted October 29, 2015 Author Posted October 29, 2015 What about this example:#include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") $a__MSOE_DblClk_Data[0] = 200 _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, "_MousePrimaryDblClk_Event") While Sleep(10) WEnd Func _MousePrimaryDblClk_Event() Return 1 EndFunc Func _Quit() Exit EndFunc? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Guest Posted October 29, 2015 Posted October 29, 2015 (edited) What about this example:#include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") $a__MSOE_DblClk_Data[0] = 200 _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, "_MousePrimaryDblClk_Event") While Sleep(10) WEnd Func _MousePrimaryDblClk_Event() Return 1 EndFunc Func _Quit() Exit EndFunc? Yes, I am using the latest version.Thanks for this code. I'll try it and I'll update you if about this problem EDIT:I get exactly the same behavior.Over time it takes more and more CPU.It's not jumping in one shot to 25% .. Over time, it uses more and more CPU until it reaches the maximum - 25%In this case if I continue to let the script run, then the in some point the script reaches to event that it is not responding - buttons "Script Paused" and "Exit" do not work anymore.That's exactly the same behavior.I think it's because my f** mouse performs extreme test to your UDF because it's super fast double clickI think this bug happens when you do super fast double click Edited October 29, 2015 by Guest
MrCreatoR Posted November 1, 2015 Author Posted November 1, 2015 I think this bug happens when you do super fast double clickI have fast double click on my middle mouse button (double click by one click on it), and i don't get the results as you get.How i can reproduce this bug? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Guest Posted November 2, 2015 Posted November 2, 2015 (edited) I have fast double click on my middle mouse button (double click by one click on it), and i don't get the results as you get.How i can reproduce this bug?It might be easier if you create debug version of this UDF that will create log file and it will record things you think are important.Then I will send you the log file and maybe this way you can figure out what causes it. Sometimes the hard way is the easy way.I know this from experience EDIT:More info:this trick #include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" ;~ HotKeySet("{ESC}", "_Quit") $a__MSOE_DblClk_Data[0] = 200 _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, "_MousePrimaryDblClk_Event") While Sleep(10000) _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, "_MousePrimaryDblClk_Event") WEnd Func _MousePrimaryDblClk_Event() Return 1 EndFunc Func _Quit() Exit EndFunc Does not solve it.It means that the problem is in higher level then _MouseSetOnEvent(*) . Edited November 2, 2015 by Guest
explorerpl Posted November 2, 2015 Posted November 2, 2015 (edited) I'm loving this UDF. Came very useful in my current project: https://www.autoitscript.com/forum/topic/178366-adobe-air-like-window/I have a question though. Probably a general one, but I just couldn't find a reliable answer to it. Could someone please direct me to a full list of Events being passed to the CallBack functions? From the UDF we can use the $iEvents to check for what type of event occured, but I don't know what those constants are. I understand they are part of WinAPI so I looked in the MSDN but I just can't make it work. I'm askin because what I'm trying to do is to build a function like Form_MouseMove from Visual Basic. It not only gives you XY coordinates of the mouse, but also the buttons being pressed while the event takes place. I understand that this could be achieved by attaching multiple events to one function and then processing the $iEvent, but I only get the "Pressed" message once - at the moment of pressing down the mouse button.#include <GUIConstantsEx.au3> #include "classes\MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") ;Set event function for mouse wheel *scrolling* up/down and primary button *down* action (call our function when the events recieved) _MouseSetOnEvent($MOUSE_MOVE_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseMove_Events") while 1 sleep(200) WEnd _Quit() Func _MouseMove_Events($iEvent) ConsoleWrite($iEvent & @CRLF) EndFunc Func _Quit() _MouseSetOnEvent($MOUSE_MOVE_EVENT) Exit EndFuncThe desired functionality would be something like this:Func _MouseMove_Event($X, $Y, $Button) ; This takes place when the mouse is moving and when any button is pressed ;$X - the X coordinate of the mouse ;$Y - the Y coordinate of the mouse ;$Button - a flag indicating mouse buttons presset while the mouse is moving ;for example ;(0) no button pressed ;(1) left mouse button pressed ;(2) right mouse button pressed ;(3) would be both - (1) and (2) Local $_buttons = "" Switch $Button case 0 $_buttons = "No button" case 1 $_buttons = "Left button" case 2 $_buttons = "Right button" case 3 $_buttons = "Left and Right button" EndSwitch ConsoleWrite("X: " & $X & ", Y: " & $Y & ", " & $_buttons) EndFuncAny help on achieving that please? Edited November 2, 2015 by explorerpl
explorerpl Posted November 2, 2015 Posted November 2, 2015 Ok. I think I figured it out more or less. What do you think? Can it be done differently? Maybe without using Global variables? Seems not elegant enough.expandcollapse popup#include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" #include <Misc.au3> Global $_MouseEventButton = 0 HotKeySet("{ESC}", "_Quit") ;Set event function for main mouse events to point to the same CallBack function _MouseSetOnEvent($MOUSE_MOVE_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseMove_Events") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _Quit() Func _MouseMove_Events($iEvent) ;create $_MouseEventButton flag if $iEvent = $MOUSE_PRIMARYDOWN_EVENT Then $_MouseEventButton += 1 if $iEvent = $MOUSE_SECONDARYDOWN_EVENT Then $_MouseEventButton += 2 if $iEvent = $MOUSE_PRIMARYUP_EVENT Then $_MouseEventButton -= 1 if $iEvent = $MOUSE_SECONDARYUP_EVENT Then $_MouseEventButton -= 2 ;fix Double Clicks causing $_MouseEventButton going down to negative values if $_MouseEventButton < 0 Then $_MouseEventButton = 0 Local $_buttons = "" Switch $_MouseEventButton case 0 $_buttons = "No button" case 1 $_buttons = "Left button" case 2 $_buttons = "Right button" case 3 $_buttons = "Left and Right button" EndSwitch ConsoleWrite($_MouseEventButton & " : " & $_buttons & @CRLF) EndFunc Func _Quit() ConsoleWrite("Exit") _MouseSetOnEvent($MOUSE_MOVE_EVENT) Exit EndFunc
MrCreatoR Posted November 2, 2015 Author Posted November 2, 2015 gil900What system you are using, what AutoIt version (version, x64?)? explorerplexpandcollapse popup#include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" #include <Misc.au3> HotKeySet("{ESC}", "_Quit") ;Set event function for main mouse events to point to the same CallBack function _MouseSetOnEvent($MOUSE_MOVE_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "_MouseMove_Events") _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseMove_Events") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _Quit() Func _MouseMove_Events($iEvent) Local Static $iLast_Event Local $_buttons = "" Switch $iEvent Case $MOUSE_PRIMARYDOWN_EVENT $_buttons = ($iLast_Event = $MOUSE_SECONDARYDOWN_EVENT ? "Right and left" : "Left") & " button" Case $MOUSE_SECONDARYDOWN_EVENT $_buttons = ($iLast_Event = $MOUSE_PRIMARYDOWN_EVENT ? "Left and Right" : "Right") & " button" Case Else $_buttons = "No button" EndSwitch $iLast_Event = $iEvent ConsoleWrite($_buttons & @CRLF) EndFunc Func _Quit() ConsoleWrite("Exit") _MouseSetOnEvent($MOUSE_MOVE_EVENT) Exit EndFuncThis is what you mean? Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
explorerpl Posted November 3, 2015 Posted November 3, 2015 Thanks for the tip, but that doesn't work. The events only set the variables when they happen. That means that the event is received when i press down the button, but ignored when I keep holding the button while moving the mouse. In result most of the console output is "No button" even though the button is being held.
MrCreatoR Posted November 3, 2015 Author Posted November 3, 2015 Thanks for the tip, but that doesn't work. The events only set the variables when they happen. That means that the event is received when i press down the button, but ignored when I keep holding the button while moving the mouse. In result most of the console output is "No button" even though the button is being held. Func _MouseMove_Events($iEvent) Local Static $iLast_Event Local $_buttons = "" Switch $iEvent Case $MOUSE_PRIMARYDOWN_EVENT $_buttons = ($iLast_Event = $MOUSE_SECONDARYDOWN_EVENT ? "Right and left" : "Left") & " button" Case $MOUSE_SECONDARYDOWN_EVENT $_buttons = ($iLast_Event = $MOUSE_PRIMARYDOWN_EVENT ? "Left and Right" : "Right") & " button" Case $MOUSE_PRIMARYUP_EVENT, $MOUSE_SECONDARYUP_EVENT, $MOUSE_MOVE_EVENT $_buttons = "No button" EndSwitch $iLast_Event = $iEvent If $_buttons <> "" Then ConsoleWrite($_buttons & @CRLF) EndIf EndFuncIf you don't want that "No button" event will be fired on mouse move, just remove $MOUSE_MOVE_EVENT from the last Case condition. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Guest Posted November 3, 2015 Posted November 3, 2015 gil900What system you are using, what AutoIt version (version, x64?)AutoIt 3.3.14.1 , script run as 32bitWindows 7 64bit
MrCreatoR Posted November 3, 2015 Author Posted November 3, 2015 (edited) AutoIt 3.3.14.1 , script run as 32bitWindows 7 64bit Ok, i found the bug.Just replace_Timer_KillTimer(0with_Timer_KillTimer($h__MSOE_AutHwndin the UDF file (it should be replaced twice). Edited November 3, 2015 by MrCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
MrCreatoR Posted November 4, 2015 Author Posted November 4, 2015 Update...v2.3 [04.11.2015]* Added user public constants $MOE_RUNDEFPROC and $MOE_BLOCKDEFPROC, to use in Event function to define current event blocking.* Fixed issue with crash on changing events array.* Fixed issue with high CPU caused by incorrect timer kill.* Docs updated. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
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