hellomoto Posted October 13, 2018 Share Posted October 13, 2018 Hello! New to AutoIt but have used AHK and some other languages. I am trying to write something where if I press a key, auto-it finds a preset color on the screen. It then locks the cursor onto that color, wherever it goes until either 1) the color is no longer on the screen or 2) I press the same key to toggle it off. I don't want any key presses or mouse clicks, just to control the mouse. Is this possible? I have found other posts on here from 10-12 years ago so I wasn't sure how much they would apply. If I'm missing recent posts that deal with this because I'm not searching the right params, please link. Thanks! Link to comment Share on other sites More sharing options...
water Posted October 13, 2018 Share Posted October 13, 2018 Welcome to AutoIt and the forum! That's a quite general question. Can you please describe which program you try to automate or which goal you try to achieve? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 13, 2018 Moderators Share Posted October 13, 2018 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion 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...
hellomoto Posted October 14, 2018 Author Share Posted October 14, 2018 It will be a program running a video clip. The clip will have a lot of movement with one specific person that shows up (and sometimes blends back into a crowd) and is as uniquely dressed as possible. Imagine where's waldo but in video. Some of these may get very hard to find, so having an "answer" button to toggle on which will move the mouse to the color and then stay on it as this person moves releasing if the color disappears and immediately regaining once it reappears. I expect there will be some variance of color allowed due to lighting changes so I'm not looking for a perfect solution, but trying to get as close as I can for this. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 14, 2018 Moderators Share Posted October 14, 2018 hellomoto, And what is the purpose of all this? 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...
hellomoto Posted October 14, 2018 Author Share Posted October 14, 2018 Well, my kids love seek and find books. I was hoping for a way to take it to the next level and make it easy to make new puzzles. Like me wearing some specific hat and having some else record on their phone in a mall, street corner, restaurant. Then I could queue this up as a way to find me if they get stuck Just for fun. Like a moving wheres waldo. Which is why I'd like it to be program agnostic. Just find the color and stay on it. I'm even thinking a snap function would be nice. So if they need a little help, they can mouse over close by and find it. Or have the option to get the answer by scanning the whole screen. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 14, 2018 Moderators Share Posted October 14, 2018 hellomoto, That sounds like a fun project - but one which is perilously close to game automation, which you will see is not permitted by the Forum rules. The thread can remain open for the moment, but will remain under review. 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...
Malkey Posted October 15, 2018 Share Posted October 15, 2018 (edited) This example may help. expandcollapse popup#include <WinAPIGdi.au3> ; Press Esc key to terminate script. ; Press Home key to toggle search for color. ; Press Shift-Alt-d keys to enter a new color. Global $g_bPaused = False, $iColor = 0x63C4AB ; "H" avatar greenish color on AutoIt Forums. ; Global $scale = _WinAPI_EnumDisplaySettings('', $ENUM_CURRENT_SETTINGS)[0] / @DesktopWidth HotKeySet("{HOME}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "SearchColor") ; Shift-Alt-d While 1 Sleep(100) WEnd Func TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) $a = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, $iColor, 5) #cs The search directions (from AutoIt help file - PixelSearch() function): Left-to-Right because "left" parameter < "right" parameter and Top-to-Bottom because "top" parameter < "bottom" parameter So, the top left search color is found first. #ce If IsArray($a) Then MouseMove($a[0] / $scale, $a[1] / $scale) ToolTip('Script is "Running"') Else ToolTip('Script is "Running"') $a = 0 EndIf WEnd ToolTip('') EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>Terminate Func SearchColor() $iColor = InputBox("Color", "Enter color (0xRRGGBB) you wish to find." & @CR & " eg. For red enter 0xFF0000", "0xFF0000") EndFunc ;==>SearchColor Edited October 15, 2018 by Malkey Replaced _GetScale() function from https://www.autoitscript.com/forum/topic/156251-mouse-coordinates/?do=findComment&comment=1130002 Link to comment Share on other sites More sharing options...
hellomoto Posted October 15, 2018 Author Share Posted October 15, 2018 Melba23, Wow. Sorry. Don't want to break any rules. I travel a lot, so there's always cool new places to do this. Kind of a virtual hide and seek. Thanks for allowing the community to help. Malkey, Gonna read through this. Thanks for the start. Link to comment Share on other sites More sharing options...
junkew Posted October 15, 2018 Share Posted October 15, 2018 if pixelsearch is not getting you further this has more indepth information on analysing pixels and finding stuff in images https://www.autoitscript.com/wiki/FAQ#How_can_I_search_an_image_in_another_image.3F FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Bert Posted October 16, 2018 Share Posted October 16, 2018 I really like this idea for it allows for a father to connect with his child. The only problem I can see is the color may change due to lighting issues thus you would need to do a color range. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
caramen Posted October 17, 2018 Share Posted October 17, 2018 (edited) I dont want to do the atmosphere breacker But it also depend of the video. There is 10 000 000 of colors. So ... gonna be hard. I will folow this project too. If you give us feedbacks . I like it too. Edited October 17, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki 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