Jump to content

Recommended Posts

Posted

I'am trying 2 make script that clicks on a certain pixel if it appears on my screen and ive ran into a snag. Heres my code with the error below it

Script

Local $Fun1 = 0x5A3701
While Not @error
$ClickHere = PixelSearch( 318, 268, 1076, 690, 0x5A3701 )
If @error Then
ExitLoop
EndIf
MouseClick (“left”, $ClickHere[1],$ClickHere[0])
WEnd

Error

C:\Program Files (x86)\AutoIt3\SciTE\test.au3(7,13) : ERROR: syntax error (illegal character)
MouseClick (“
~~~~~~~~~~~~^
C:\Program Files (x86)\AutoIt3\SciTE\test.au3 - 1 error(s), 0 warning(s)

Any help would be nice.

Posted (edited)

HotKeySet("!^c","_Click")

Func _Click()
Local $Fun1 = 0x5A3701
While Not @error
      $ClickHere = PixelSearch( 318, 268, 1076, 690, 0x5A3701 )
      If @error Then ;not sure
          ExitLoop   ;you need
      EndIf          ;these lines
      MouseClick ("left", $ClickHere[1],$ClickHere[0])
WEnd
EndFunc

I dont know where your double quotes come from but they are not standard

try above.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

thank you both but how would i add a hot key to it? so that i could start and stop the pixel search?

You could use this to start it, I'm not sure how to stop it without exiting the script though.

HotKeySet("{F2}"), "Pixel_Search")

Func Pixel_Search()
Local $Fun1 = 0x5A3701
While Not @error
$ClickHere = PixelSearch( 318, 268, 1076, 690, 0x5A3701 )
If @error Then
ExitLoop
EndIf
MouseClick ("left", $ClickHere[1],$ClickHere[0])
WEnd
EndFunc

I'm still learning, if this is incorrect, let me know.

Posted

HotKeySet("!^c","_Click")

Func _Click()
Local $Fun1 = 0x5A3701
While Not @error
      $ClickHere = PixelSearch( 318, 268, 1076, 690, 0x5A3701 )
      If @error Then ;not sure
          ExitLoop   ;you need
      EndIf          ;these lines
      MouseClick ("left", $ClickHere[1],$ClickHere[0])
WEnd
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...