Jump to content

autoclick Image Search macro - (Moved)


CofMofo
 Share

Recommended Posts

Hello, I'm pretty new to Autoit and programming in general but I tried to read up. Almost everything I know I found on these forums. Amazing community. But I don't know how to continue. Here's what I got :

Click once on specified position, then sleep for 50 seconds, then search for the image for 15 seconds. If the image is found move mouse on it's position (for now) and repeat the process, if the image is not found after 15 seconds (go in a loop that plays up to 9 times, repeats the imagesearch but clicks another position) I have this loop ready but I stripped everything to a minimum so I can see where the problem is, but the script doesn't even start.

So far I have this:

#include <Constants.au3>
#include <ImageSearch2015.au3>
$x1=0
$y1=0
$pictureWIN = "C:\Program Files (x86)\AutoIt3\ImageSearch2015\YouWin.png"


Func Main()


   MouseMove (995,852,200)			
   MouseClick("Left")
   Sleep (50000)				


	  $timer

	  While True

	  $timer = TimerInit()
		 Do
			Do
			   $result = _ImageSearch ($pictureWIN,1,0,0)
			   ConsoleWrite($result)
			Until $result = 1;
			If ($result=1) Then
			   MouseMove ($x1,$y1,200)
			EndIf
		 Until TimerDiff($timer) > 15000 ; 15 seconds
		 If ($timer > 15000) Then
			ToolTip("Lose", 0, 0)
			Sleep(2000)
		 EndIf
	  WEnd


EndFunc

If I saparate the code and run it piece by piece it works (mouse move and clicks work, imageserarch works) but if I run this piece of code, nothing happens. Any advice?

 

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum.

Moderation Team

Also, how about some more information on what you are trying to accomplish?

***In case you missed it, this is a Mod stepping into a thread***

Edit - As an awareness to the peanut gallery, reporting a thread after a Moderator has stepped into it is the same as posting in the thread itself. If one of us has stepped in to ask questions, I would think it apparent it doesn't need to be reported.

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!

Link to comment
Share on other sites

  • Moderators

@CofMofo as I see you have been online and have viewed this thread, choosing not to answer my question, thread locked. Please read the forum rules before you post again.

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!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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