Jump to content

Recommended Posts

Posted

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!

example1.png

  • Moderators
Posted

@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!

  • Moderators
Posted

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!

Posted

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.

Posted

 

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
Posted (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 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!

Posted
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!

  • Moderators
Posted

@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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...