Jump to content

Recommended Posts

Posted

hey sorry if this is a no brainer but im still just learning. however i can not foigure out why this doesent work. what i want it to do is to moove to random position in a box i have made for it but for some reason its clicking way over the place. here is the code that should work however it isnt. any help is appricited

 

......
               Else
                MouseMove(Random(47,897,1), Random(280,1037,1), 0)

            Sleep(500)
               EndIf
......

 

  • Moderators
Posted

@Daruman you cannot expect decent help based off 3 lines with no context. Post your entire code, or a decent reproducer at least, if you wish help.

"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
16 minutes ago, JLogan3o13 said:

@Daruman you cannot expect decent help based off 3 lines with no context. Post your entire code, or a decent reproducer at least, if you wish help.

HotKeySet("{ESC}", "quit") ;ESC to quit

      While 1

            $Box = PixelSearch(30,89,1789,855,0xF1C393)
               If IsArray($Box) Then
                  MouseMove($Box[0],$Box[1],0)
                  MouseClick("left")
                  Sleep(1750)
               Else
                MouseMove(Random(47,897,1), Random(280,1037,1), 0)
                MouseClick(left)
            Sleep(5000)
               EndIf

      WEnd

Func quit()
   Exit
EndFunc

it searches in a box for pixel and if found it click it (that part works fine) if however its not found its suposed to click into random pos a another smaller box. that part is acting up. it clicks all over desktop for some reason

Posted (edited)
45 minutes ago, Daruman said:

hey sorry if this is a no brainer but im still just learning. however i can not foigure out why this doesent work. what i want it to do is to moove to random position in a box i have made for it but for some reason its clicking way over the place. here is the code that should work however it isnt. any help is appricited

 

......
               Else
                MouseMove(Random(47,897,1), Random(280,1037,1), 0)

            Sleep(500)
               EndIf
......

 

We dont get to have the original if only the else - like subz says got to repair my crystal ball.  Fascinating story btw.

Ty now.  Can I ask you what is the application you want to automate ?

Edited by Nine
Posted
26 minutes ago, Nine said:

 

Ty now.  Can I ask you what is the application you want to automate ?

custom made "game"  just for learning purposes

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
  • Recently Browsing   0 members

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