Jump to content

Problems with active window and clicks


petrolea
 Share

Recommended Posts

Hi everyone!

I'm having some difficulties with a script running in Windows 7. The script is working fine but there's one big problem.

The mouse is hovering over the program just fine and moving from one point to another but only if the program that was supposed to recieve the clicks is not focused. But if I click on the window and make it "active" the script stops. If I click outside the window it just starts running again. It is like it is totally ignoring the window it was supposed to click on and it sends clicks to the desktop.

Btw, I'm using a picture editing software and I want it to click on the pixels of some color to change them to some other color (I know it's not useful but I'm just practicing).

Any help would be greatly appreciated :mellow:

This is the code if it helps:

HotKeySet("{f6}", "_Exit")
while 1
sleep(1000)
  $var = PixelSearch(642, 83, 1663, 855, 0xDEA34A)
  if IsArray($var) Then
   MouseMove($var[0], $var[1], 15)
   MouseClick("primary", $var[0], $var[1], 1)
  Else
   sleep(1000)
   ConsoleWrite("Can't find pixel!")
  EndIf
WEnd
Func _Exit()
Exit
EndFunc
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...