Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 21:12

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

Advertisement



hilfe ImageSearch Random Click auf Bild?

Discussion on hilfe ImageSearch Random Click auf Bild? within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
loop88's Avatar
 
elite*gold: 0
Join Date: Dec 2013
Posts: 47
Received Thanks: 9
Question hilfe ImageSearch Random Click auf Bild?

Hallo ich verstehe noch nicht so viel von Autoit da wollte ich fragen wie kann ich bei ImagenSearch ein Ronadom Click machen auf das gesuchte bild.

Wer kann mir helfen?

Danke.

Mein code:

Code:
#include <ImageSearch.au3>

HotKeySet("{TAB}", "Inicio")
HotKeySet("{p}", "pausa")

$x1=0
$y1=0
Global $pausa

Func Inicio()
While True
	If Not $pausa Then

	  $IMG1=_ImageSearch("IMG.png",1,$x1,$y1,60)
	      If $IMG1=1 Then
			    MouseClick("LEFT",$x1,$y1)
				Sleep(2000)
			EndIf
	EndIf
WEnd
EndFunc

Func pausa()
	If $pausa Then
		$pausa = False
	Else
		$pausa = True
	EndIf
EndFunc

While 1
	Sleep(1)
WEnd
kann geclosed werden
loop88 is offline  
Old 02/01/2014, 17:33   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Das mit der Grammatik kriegst du wohl auch nicht auf die Kette was?
alpines is offline  
Old 02/01/2014, 17:37   #3
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
ich hab zwar keine ahnung was du willst, aber nachdem $img auf 1 gesetzt wurde muss es auch wieder auf 0 gesetzt werden.
butter123 is offline  
Old 02/01/2014, 17:53   #4
 
loop88's Avatar
 
elite*gold: 0
Join Date: Dec 2013
Posts: 47
Received Thanks: 9
Quote:
Originally Posted by alpines View Post
Das mit der Grammatik kriegst du wohl auch nicht auf die Kette was?
dass konte wohl daran liegen dass ich nicht aus deutschland bin, und noch nicht richtig deutsch schreiben gelernt habe!!
loop88 is offline  
Old 02/01/2014, 18:28   #5
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Wenn du dich in Englisch besser artikulieren kannst wird dir das niemand verwehren.
butter123, das muss nich auf 0 gesetzt werden, da ImageSearch eine 0 returned wenn nichts gefunden wird.
alpines is offline  
Old 02/01/2014, 18:54   #6
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
Immer diese Kleinscheißerei... Verstehen kann man es doch ohne Probleme, nur ob man die Frage richtig interpretiert ist wichtig. Das kann man auch bei vollständig korrekter Grammatik nicht immer.

Code:
#include <ImageSearch.au3>

HotKeySet("{p}", "_TogglePause")

Global Const $imageFile = @ScriptDir & "\IMG.png"
Global Const $imageWidth = 100, $imageHeight = 100
Global $paused, $x, $y

While Sleep(10)
    If Not $paused Then
        $returnValue = _ImageSearch($imageFile, 0, $x, $y, 60)
        If $returnValue == 0 Then
            MouseClick("primary", $x + Random(0, $imageWidth), $y + Random(0, $imageHeight))
            Sleep(2000)
        EndIf
    EndIf
WEnd

Func _TogglePause()
    $paused = Not $paused
EndFunc
Die Variablen $imageWidth und $imageHeight müssen natürlich noch auf die entsprechenden Werte des Bildes angepasst werden.
KDeluxe is offline  
Thanks
2 Users
Old 02/01/2014, 19:14   #7
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Returned _ImageSearch nicht 1 wenn die suche erfolgreich ist? Warum prüfst du auf 0?
Eigentlich geht das so schöner
Code:
If _ImageSearch($imageFile, 0, $x, $y, 60) Then
       MouseClick("left", $x + Random(0, $imageWidth, 1), $y + Random(0, $imageHeight, 1))
       Sleep(2000)
EndIf
alpines is offline  
Old 02/01/2014, 20:45   #8
 
loop88's Avatar
 
elite*gold: 0
Join Date: Dec 2013
Posts: 47
Received Thanks: 9
Wink

Quote:
Originally Posted by KDeluxe View Post
Immer diese Kleinscheißerei... Verstehen kann man es doch ohne Probleme, nur ob man die Frage richtig interpretiert ist wichtig. Das kann man auch bei vollständig korrekter Grammatik nicht immer.

Code:
#include <ImageSearch.au3>

HotKeySet("{p}", "_TogglePause")

Global Const $imageFile = @ScriptDir & "\IMG.png"
Global Const $imageWidth = 100, $imageHeight = 100
Global $paused, $x, $y

While Sleep(10)
    If Not $paused Then
        $returnValue = _ImageSearch($imageFile, 0, $x, $y, 60)
        If $returnValue == 0 Then
            MouseClick("primary", $x + Random(0, $imageWidth), $y + Random(0, $imageHeight))
            Sleep(2000)
        EndIf
    EndIf
WEnd

Func _TogglePause()
    $paused = Not $paused
EndFunc
Die Variablen $imageWidth und $imageHeight müssen natürlich noch auf die entsprechenden Werte des Bildes angepasst werden.
Vielen Vielen Dank, werde gleich mal alles ausprobieren
loop88 is offline  
Old 02/01/2014, 21:45   #9
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
Quote:
Originally Posted by alpines View Post
butter123, das muss nich auf 0 gesetzt werden, da ImageSearch eine 0 returned wenn nichts gefunden wird.
peinlich, da war ich wohl etwas voreilig
butter123 is offline  
Reply


Similar Threads Similar Threads
how to make random mouse click
06/28/2013 - AutoIt - 5 Replies
well i have movable gui and i want to make random mouseclicks inside the gui gui positions are $Bpos $Bpos $Bpos $Bpos. and i want clicks to be made in lower right corner of the gui. well that messed up my head lol well here is the screen of this movable gui the area where random clicks should be made is painted black: http://www.upload.ee/image/3407420/vajadus123.jpg
[PHP]Random Bild für Signatur
01/08/2013 - Web Development - 11 Replies
Hallo :) Daher mich die Größenbegrenzung bei .: UzziSoft :. stört, dacht ich mir, mach ich das selber. Ein Bild Random anzuzeigen, kein Problem: <?php $file_array = array ('images/a.png', 'images/b.png', 'images/c.png'); $total = count($file_array); $random = (mt_rand()%$total);
Facebook App random bild? Bei erfolgreicher hilfe 50 EGOLD
03/15/2012 - elite*gold Trading - 7 Replies
Hi Leute, ich mache seit heute verschiedene Facebook Apps, jedoch nur wo der Text anders ist. Jetzt will ich aber, das ein Random Bild erscheint. Kann mir da jemand helfen? Danke! Hier mal ein auszug aus der config php $_CONFIG = './kberry.ttf'; $_CONFIG = 18; $_CONFIG = -1; /* -1 für CENTER! */
autoit findet mit imagesearch das bild im spiel nicht oO?
01/21/2010 - AutoIt - 7 Replies
hallo, ich habe folgendes programm geschrieben: #include <ImageSearch.au3> Global $fenster Global $active = 0 $x = 0 $y = 0



All times are GMT +2. The time now is 21:12.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.