mclopes Posted March 4, 2019 Posted March 4, 2019 Looking in the forum I found this code: HotKeySet("{esc}","quit") $pix=PixelGetColor(1595,770) $quit=False Do sleep(50) $pix2=PixelGetColor(1595,770) if $pix <> $pix2 then MsgBox(0,"", "That Pixel Has Changed",0) $pix=PixelGetColor(1595,770) EndIf until $quit=true func quit() $quit=True MsgBox(0,"","Bye",0) EndFunc It detects when a pixel has changed color But I need to detect when a color changes from 008000 to FF0000, or the reverse, and when that happens, I need to perform an action, only once (only when the change happens) I tried several examples, but I'm a beginner and I could not make the action happen once, can anyone help me? Thanks
careca Posted March 4, 2019 Posted March 4, 2019 It should be a simple case of: if 008000 true, then loop until false, and do the action right after the loop. Start with one color, and make it work, then proceed to more complexity, 2 or more colors. If you dont understand the code, it would be a great idea to start checking the help file for the functions and their usage etc. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
mclopes Posted March 4, 2019 Author Posted March 4, 2019 25 minutes ago, careca said: It should be a simple case of: if 008000 true, then loop until false, and do the action right after the loop. Start with one color, and make it work, then proceed to more complexity, 2 or more colors. If you dont understand the code, it would be a great idea to start checking the help file for the functions and their usage etc. Hi Careca, you mean I should use PixelSearch, to return a true / false?
Nine Posted March 4, 2019 Posted March 4, 2019 9 minutes ago, mclopes said: I should use PixelSearch, to return a true / false? PixelSearch does not return true or false. Read help file carefully. And it searches for one color (with variation) at a time. You need to look for 2 very different colors. So PixelGetColor is better fitted for you. Change your code to look for either color, when it finds one, continue loop until it finds the other color. A While True...Wend seems more appropriate for your need. Put together a script that would attempt to do it, post your code here if you hit a wall... “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
water Posted March 4, 2019 Posted March 4, 2019 If you can tell us what you try to achieve we can tell you if working with pixels is the best approach. AutoIt offers a lot of very reliable functions which are most of the time better suited than Pixel* functions. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Bert Posted March 5, 2019 Posted March 5, 2019 3 hours ago, water said: If you can tell us what you try to achieve we can tell you if working with pixels is the best approach. AutoIt offers a lot of very reliable functions which are most of the time better suited than Pixel* functions. Agreed - pixel searching is the worst way to automate. WHat are you trying to automate? The Vollatran project My blog: http://www.vollysinterestingshit.com/
mclopes Posted March 5, 2019 Author Posted March 5, 2019 1 hour ago, Bert said: Agreed - pixel searching is the worst way to automate. WHat are you trying to automate? Hello, thank you all, for the help, I intend to automate a stock trading system, when the bar indicator (yellow arrow) turn red will be triggered the sales order, when green will be triggered a purchase order.
Bert Posted March 5, 2019 Posted March 5, 2019 OK, Who made the app? I ask for I wonder if there are additional controls that may be controlled by command line or a macro. Also it may have an API we can hook into. The Vollatran project My blog: http://www.vollysinterestingshit.com/
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