Bruno45r Posted March 7, 2019 Posted March 7, 2019 Hello guys, I wanted to make a script that would scan a certain section of the screen (with pixel search) and if it that section is red, then it would send a number 2 and would scan the same section again and if it was still red, then it would send a number 3 and so on, 'till number 10. But if that section of the screen is green, then it would go back to number 1. HotKeySet("{ESC}", "MyExit") MouseClick("left", 114, 15, 1, 10);Click the window $pix1= PixelSearch(219, 396, 247, 413, 0x42464D);checks if the window is open. If @error Then MouseClick("left", 157, 403, 1, 10) EndIf While 1 $red= PixelSearch(219, 396, 247, 413, 0xFF0000);searches for the color red on a specific section of the screen. If Not @error Then Send("Number 2") Elseif @error Then Send("Number 1") WEnd Func myExit() MsgBox(0, "Exiting", "Exiting") Exit EndFunc I'm stuck here, I don't know how to make it add more numbers as the color red repeats. I've tried other stuff, but it didn't work. Can anyone help me with that? Is it possible to do this? Thanks in advance!
Moderators JLogan3o13 Posted March 7, 2019 Moderators Posted March 7, 2019 @Bruno45r welcome to the forum. Short answer is yes, but more information on what you're trying to do would be helpful. Longer answer is the more information you can provide the better we are able to suggest the many likely methods that are far better than pixelsearch "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Bruno45r Posted March 7, 2019 Author Posted March 7, 2019 I want to combine it with a script that sends random emojis red/green and the first to get to 10 wins. It's gonna a kind of game.
Moderators JLogan3o13 Posted March 7, 2019 Moderators Posted March 7, 2019 So what determines what color shows up in the area you are searching? Also, if you have not already, please ensure you are familiar with our forum rules. ===In case you missed it, this is a Mod stepping into a thread=== "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Bruno45r Posted March 7, 2019 Author Posted March 7, 2019 An emoji. If it sends a green emoji, for example, the script will read it with pixelsearch or imagesearch and then it'll retrieve a number 1, if it sends a red emoji, it'll send a number 2, if it sends a red emoji again, it'll send a number 3 and so on. HotKeySet("{ESC}", "MyExit") While 1 $red= PixelSearch(390, 453, 393, 596, 0xE53935) If not @error Then Send("Number 2") Send("{ENTER}") Sleep(200) Else Send("Number 1") Send("{ENTER}") Sleep(200) EndIf WEnd Func myExit() MsgBox(0, "Exiting", "Exiting script") Exit EndFunc Now I wanted to add a number '3,4,5' there, but I don't know how. In case it sent a green emoji, then it would go back to number 1.
Moderators JLogan3o13 Posted March 7, 2019 Moderators Posted March 7, 2019 You're saying "it sends an emoji" I'm trying to clarify, what is "it" Is it a webpage? A desktop app? etc. And which? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Bruno45r Posted March 7, 2019 Author Posted March 7, 2019 Oh, sorry. It's an app called Whatsapp, it can also be accessed from PC. I'm using the PC version.
rm4453 Posted March 8, 2019 Posted March 8, 2019 For each iteration of the loop, you would want to check if the pixels are there. If so you would want to increment your loop counter, send the desired text, else you would want to reset your loop counter; repeat the loop until closing the program. <- That statement contains all the info you need.
Moderators JLogan3o13 Posted March 8, 2019 Moderators Posted March 8, 2019 (edited) I am fine for the thread to continue, so long as you look at the WhatsApp TOS, specifically the portion on anti-spamming: "not using bots to send more messages than normally possible by a human". We will not support such discussions. @rm4453 in the future, when a Moderator is working in a thread to determine legitimacy, you need to stay out of it. Edited March 8, 2019 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
rm4453 Posted March 9, 2019 Posted March 9, 2019 7 hours ago, JLogan3o13 said: I am fine for the thread to continue, so long as you look at the WhatsApp TOS, specifically the portion on anti-spamming: "not using bots to send more messages than normally possible by a human". We will not support such discussions. @rm4453 in the future, when a Moderator is working in a thread to determine legitimacy, you need to stay out of it. I misunderstood, and thought the decision was already made. I appreciate the clarification. Will do my best not to cause that issue any further. Thanks!
Bruno45r Posted March 9, 2019 Author Posted March 9, 2019 I'm not using the app to spam, I think you misunderstood me, I need the script to read what someone else (a person) sent.
Moderators JLogan3o13 Posted March 11, 2019 Moderators Posted March 11, 2019 @Bruno45r and that is fine, my statement was just an awareness not to let the thread devolve into that realm. So long as it doesn't, people are free to help you if they wish. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Nine Posted March 11, 2019 Posted March 11, 2019 You need to use a $iCounter that would be set to 1 before the while. If the color is right increment it like $iCounter += 1 up to 10. Reset to 1 if color is NOT right. “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
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