beamtenversteher Posted February 10, 2022 Share Posted February 10, 2022 Hi, based on this topic https://www.autoitscript.com/forum/topic/207507-mouse_primarydblclk_event-moved/ i would like to know how i create a function which gives me the possibility to specify a area on the screen where the mouse click will take an effect. In my case coordinates for top left (980,168) and bottom right (1700, 1270) are given - in this area the double mouse click script should work - in all other areas not.... Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2022 Share Posted February 10, 2022 _MouseTrap (see help file) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted February 10, 2022 Share Posted February 10, 2022 Hi @beamtenversteher, if the suggestion of @Nine is what you're looking for (I am not fully sure), then please don't forget to release the mouse by _MouseTrap() before you end your script 😉 . Best regards Sven ________________Stay innovative! Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
ad777 Posted February 10, 2022 Share Posted February 10, 2022 (edited) @beamtenversteher Disable DB Mouse Click event: _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent", $hGUI) Enable DB Mouse Click event: _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) DIsable/Enable DB Mouse Click event: While 1 $Left = 980 $Top = 168 $Right = 1270 $Bottom = 1700 If MouseGetPos(0) > $Left And MouseGetPos(0) < $Right And MouseGetPos(1) > $Top And MouseGetPos(1) < $Bottom Then _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) Else _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent", $hGUI) EndIf WEnd Edited February 10, 2022 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
beamtenversteher Posted February 10, 2022 Author Share Posted February 10, 2022 many thx!!! if i understand u correctly it should looks like Quote expandcollapse popup#include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") _BlockDBClick() Func _BlockDBClick() Local $hGUI = GUICreate("") GUISetState(@SW_HIDE, -1) _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) While 1 $Left = 400 $Top = 220 $Right = 1300 $Bottom = 900 If MouseGetPos(1) > $Left And MouseGetPos(1) < $Right And MouseGetPos(0) > $Top And MouseGetPos(0) < $Bottom Then _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) Else _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent", $hGUI) EndIf WEnd EndFunc ;==>_BlockDBClick Func _MouseDBEvent() Send("u") ;;send u ;;;;do stuff Return $MOE_BLOCKDEFPROC ;Block EndFunc ;==>_MouseDBEvent Func _Quit() Exit EndFunc ;==>_Quit that in between the coordinates the script works as expected and outside not doulbe click will be done/possible? ive switches 0 to 1 and vice versa but the result is not that precise. sometimes the click outside the box (of the coordinates the send of the key still works. Maybe a bit more save would be if in the area of the coordinates the script is running and out side like no script is working (what means that no key should be sent) r Link to comment Share on other sites More sharing options...
Solution ad777 Posted February 10, 2022 Solution Share Posted February 10, 2022 @beamtenversteher you mean just like reverse(out side no send) like this: expandcollapse popup#include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" #include <Misc.au3> HotKeySet("{ESC}", "_Quit") _BlockDBClick() Func _BlockDBClick() Global $hGUI = GUICreate("") GUISetState(@SW_HIDE, -1) _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) While 1 $Left = 400 $Top = 220 $Right = 1300 $Bottom = 900 If MouseGetPos(0) > $Left And MouseGetPos(0) < $Right And MouseGetPos(1) > $Top And MouseGetPos(1) < $Bottom Then _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MouseDBEvent", $hGUI) Else _MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch ;Sleep(10) WEnd EndFunc ;==>_BlockDBClick Func _MouseDBEvent() Send("u") ;;send Win+r ;;;;do stuff Return $MOE_BLOCKDEFPROC ;Block EndFunc ;==>_MouseDBEvent Func _Quit() Exit EndFunc ;==>_Quit iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
beamtenversteher Posted February 10, 2022 Author Share Posted February 10, 2022 yes....only switch deactivated with activated 🙂 thx 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