Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 16:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[autoit]how to make a good cicle

Discussion on [autoit]how to make a good cicle within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2015
Posts: 2
Received Thanks: 0
[autoit]how to make a good cicle

Hi, i trying to make a cicle. This is my code:

Code:
#include <ImageSearch.au3>
HotKeySet("{ESC}", "Terminate")
$x = 0
$y = 0

Func Terminate()
    Exit
EndFunc



#Region 
Dim $myPics[10]
$myPics[0] = 2
$myPics[1] = 'dona.png'
$myPics[2] = 'altre.png'

$res = _WaitForImagesSearch($myPics,5,1,$x,$y,100)
Switch $res
	Case 0
		MsgBox(0,'','nessuno trovato')
	 Case 1
While True = True

    Sleep(300) 
        MouseClick("left",$x, $y)
		MouseClick("left",$x, $y)

Wend
		MsgBox(0,'','donazione trovata')
	 Case 2

		While True = True
		sleep(300)
		
		MouseMove($x,$y,100)
		mouseclick("left")
		MsgBox(0,'','richieste trovate')
		
Wend
EndSwitch
it work but for example,
in Case 1 i want once image hide( because if I click this image it hide) it click the next same image. When all same images are all hide , the script work to step 2..
Someone can help me? please i'm searching all over the web but i don't find nothing about this. Thanks
matty95srk is offline  
Old 03/13/2015, 18:22   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
Hi!

Sorry for this but your loop looks awful :C

The problem is your switch will work the first time then will click until deaht.

lets say that imagesearch function return 1

>then you have this

case 1
while 1 // is the same as true = true but never heard of someone using that lol

//do something

wend

so the program stays there for ever, since 1 will always be 1 and the
loop never ends

So the while loop will work better out of the switch

Code:
while sleep(20) //reduce cpu usage
$res = _waitforImageSearch(bla,bla,bla)  //will search for the image don't know how this function 
//works but u are using an array and not sure if its searching what u want

switch $res  
case 0
//do something
case 1
//do something
case 2
//do something

endswitch
wend
elmarcia is offline  
Reply




All times are GMT +1. The time now is 16:04.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.