Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 14:32

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

Advertisement



Case oder For oder While?

Discussion on Case oder For oder While? within the AutoIt forum part of the Coders Den category.

Reply
 
Old 06/18/2011, 22:20   #16
 
Reeek's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1,304
Received Thanks: 485
lade mir die Datei gerade runter, mal sehen ob mein Script wirklich nicht klappt

bei mir kommt leider das Fenster nicht xD was muss man dafür machen?
Reeek is offline  
Thanks
1 User
Old 06/19/2011, 11:46   #17
 
elite*gold: 0
Join Date: Jun 2011
Posts: 67
Received Thanks: 4
Schließen und neu Starten dann kommt es bei mir nutze es aber schon 30 Tage.
Guck mal bei Regedit ob bei dir was anderes Steht:
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\Root\ LEGACY_******\0000]
"Service"="*****"
"Legacy"=dword:00000001
"ConfigFlags"=dword:00000000
"Class"="LegacyDriver"
"ClassGUID"="{8ECC055D-047F-11D1-A537-0000F8753ED1}"
"DeviceDesc"="****** kernel mode driver"
"Capabilities"=dword:00000000
"Driver"="{8ECC055D-047F-11D1-A537-0000F8753ED1}\\0001"

Warum kann ich das nicht mit den arrays definiren was ich will das ist doch übersichtlicher.
Code:
WinActivate("[CLASS:TFCB]")
Sleep (2000)
WinWaitActive("[CLASS:TFCB]")
Sleep (2000)
WinActivate("[CLASS:TSplashScreen]")
Sleep (2000)
WinWaitActive("[CLASS:TSplashScreen]")
Sleep (2000)

Dim $Bild[5] ; Array wird definiert
$Bild[0] = "1.bmp" ; bei 0 wird begonnen
$Bild[1] = "2.bmp"
$Bild[2] = "3.bmp"
$Bild[3] = "4.bmp"
$Bild[4] = "5.bmp"

;~ _ArrayDisplay( $Bild, "Bild array" )

Dim $Button[5] ; Array wird definiert
$Button[0] = "5" ; bei 0 wird begonnen
$Button[1] = "4"
$Button[2] = "3"
$Button[3] = "2"
$Button[4] = "1"

;~ _ArrayDisplay( $Button, "Button array" )

While 1
	For $a = 1 To 5 step 1
		$x1=0
        $y1=0
	$result = _ImageSearch(@ScriptDir & $a & ".bmp",1,$x1,$y1,0)
		If $result = 1 Then 
MsgBox(0, "Der Wert ist:", $a)
		
		EndIf
		Next
	
	Switch $a
    Case 1
		$b=0
		WinWaitActive("[CLASS:TSplashScreen]",$Button[$b])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",$b)
	Case 2
		$b=1
		WinWaitActive("[CLASS:TSplashScreen]",$Button[$b])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",$b)
	Case 3
		$b=2
		WinWaitActive("[CLASS:TSplashScreen]",$Button[$b])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",$b)
	Case 4
		$b=3
		WinWaitActive("[CLASS:TSplashScreen]",$Button[$b])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",$b)
	Case 5
		$b=4
		WinWaitActive("[CLASS:TSplashScreen]",$Button[$b])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",$b)
EndSwitch
	ExitLoop(2)
	WEnd
		
		

;~ wenn $a = Bild1 drücke $Button[5] und wenn $a = Bild drücke $Button[1] und so weiter
Exit
Ist doch mein erster Code also so Ausführlich wie möglich.
Die For schleife geht schon aber so lern ich ja nicht wie es mit den Arrays geht und dafür sind die doch da, zur definition von Variablen also müsste das doch auch gehen.
$result = _ImageSearch(@ScriptDir & $Bild[$a],1,$x1,$y1,0)
Vierus.exe is offline  
Old 06/19/2011, 16:22   #18
 
Reeek's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1,304
Received Thanks: 485
aah, jetzt verstehe ich den Code! So kannst du es natürlich auch machen... ist aber unnötig kompliziert, aber zum lernen ganz gut. Wieso arbeitest du eigentlich so viel mit WinWaitActivate? Hast du 2 Fenster?
Reeek is offline  
Thanks
1 User
Old 06/19/2011, 18:30   #19
 
elite*gold: 0
Join Date: Jun 2011
Posts: 67
Received Thanks: 4
*** das erste ist das Hauptfenster und das 2. ist der Splash der sich öffnet wo die Zahl und die buttons kommen. Wie müsste das dann aussehen das da oben läuft ja so nicht ganz.
MIT Arrays Bitte.
Vierus.exe is offline  
Old 06/19/2011, 19:06   #20
 
Reeek's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1,304
Received Thanks: 485
willst du, dass der Bot selbst draufdrückt oder nur ausgibt, welche Zahl da steht?
Reeek is offline  
Thanks
1 User
Old 06/19/2011, 19:43   #21
 
elite*gold: 0
Join Date: Jun 2011
Posts: 67
Received Thanks: 4
Beides wenns geht kann man ja auch auskomentieren.
Fertig soll der Bot dann:
1. Das Programm Starten (der Bot kommt dann in den Autostart)
2. 5-10 sekunden warten bis die Zahl erscheint
3. dann (mir sagen welche es ist,zur Prüfung und zum Verständniss)
4. dann den Button drücken und mir sagen welchen er gedrückt hatt(möglichst mal mit dem Handle und Controlklick arbeiten zum bessern Verstehen)
5. das Fenster schließen und Bot Beenden

MfG
Vierus
Vierus.exe is offline  
Old 06/19/2011, 21:12   #22
 
Reeek's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1,304
Received Thanks: 485
muss dir bei den WinActivate jetzt mal vertrauen, bekomme das doofe Fenster einfach nicht xD

PHP Code:
#include <array.au3>
WinActivate("[CLASS:TFCB]")
WinWaitActive("[CLASS:TFCB]")
WinActivate("[CLASS:TSplashScreen]")
WinWaitActive("[CLASS:TSplashScreen]")
Dim $Bild[5] ; Array wird definiert
$Bild
[0] = "1.bmp" bei 0 wird begonnen
$Bild
[1] = "2.bmp"
$Bild[2] = "3.bmp"
$Bild[3] = "4.bmp"
$Bild[4] = "5.bmp"
For $a 0 to 4 step 1
    $result 
_ImageSearch($Bild[$a],1,0,0,0)
    If 
$result<>0 Then
        MsgBox
(0"Der Wert ist:"$a)
        
exitloop(2)
    EndIf
Next

send
("{enter}")
select $a
case 1
    MouseClick
("left"XY von button1)
case 
2
    MouseClick
("left"XY von button2)
case 
3
    MouseClick
("left"XY von button3)
case 
4
    MouseClick
("left"XY von button4)
case 
5
    MouseClick
("left"XY von button5)
EndSelect
Exit 
Reeek is offline  
Thanks
1 User
Old 06/19/2011, 21:48   #23
 
elite*gold: 0
Join Date: Jun 2011
Posts: 67
Received Thanks: 4
Syntax Error bei :
******************** : ERROR: _ImageSearch() called with Const or expression on ByRef-param(s).
$result = _ImageSearch($Bild[$a],1,0,0,0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Hmm
Kann man das Array auch so setzen?
$Bild[0] = ("1.bmp",1,0,0,0)
der liest aber die Komas nicht.
Vierus.exe is offline  
Old 06/19/2011, 21:56   #24
 
Reeek's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1,304
Received Thanks: 485
nja, nächster test:

PHP Code:
#include <array.au3>
#include <imagesearch.au3>
WinActivate("[CLASS:TFCB]")
WinWaitActive("[CLASS:TFCB]")
WinActivate("[CLASS:TSplashScreen]")
WinWaitActive("[CLASS:TSplashScreen]")
Dim $Bild[5] ; Array wird definiert
$Bild
[0] = "1.bmp" bei 0 wird begonnen
$Bild
[1] = "2.bmp"
$Bild[2] = "3.bmp"
$Bild[3] = "4.bmp"
$Bild[4] = "5.bmp"
For $a 0 to 4 step 1
    $result 
_ImgSearch($Bild[$a])
    If 
$result<>0 Then
        MsgBox
(0"Der Wert ist:"$a)
        
exitloop(2)
    EndIf
Next

send
("{enter}")
select 
case $a 1
    MouseClick
("left"11)
case 
$a 2
    MouseClick
("left"1)
case 
$a 3
    
    MouseClick
("left"1)
case 
$a=4
    MouseClick
("left"1)
case 
$a=5
    MouseClick
("left"11)
EndSelect
Exit  

 
Func _ImgSearch($sPic$iTimeout 1$bClick 1$iTol 5)
     
Local $iX 0$iY 0$bResult 0$iTimer TimerInit()
     
$aPics StringRegExp($sPic'([^|]+)'3)

     While 
TimerDiff($iTimer) < $iTimeout
         
For $i 0 To UBound($aPics) - 1
             $bResult 
_ImageSearch(@ScriptDir "/Data/" $aPics[$i] & ".bmp"1$iX$iY$iTol)
             If 
$bResult 1 Then ExitLoop(2)
             
Sleep(50)
         
Next
     WEnd
         

     
Return $bResult
 EndFunc   
;==>_ImgSearch 
Reeek is offline  
Thanks
1 User
Old 06/19/2011, 22:18   #25
 
elite*gold: 0
Join Date: Jun 2011
Posts: 67
Received Thanks: 4
Es kommt nur Drücke 1 warum das den.
Also fehlt ja die andere Msg box.
Code:
#include <array.au3>
#include <imagesearch.au3>
WinActivate("[CLASS:TFCB]")
WinWaitActive("[CLASS:TFCB]")
WinActivate("[CLASS:TSplashScreen]")
WinWaitActive("[CLASS:TSplashScreen]")
Dim $Button[5] ; Array wird definiert
$Button[0] = "5" ; bei 0 wird begonnen
$Button[1] = "4"
$Button[2] = "3"
$Button[3] = "2"
$Button[4] = "1"

Dim $Bild[5] ; Array wird definiert
$Bild[0] = "1.bmp" ; bei 0 wird begonnen
$Bild[1] = "2.bmp"
$Bild[2] = "3.bmp"
$Bild[3] = "4.bmp"
$Bild[4] = "5.bmp"
For $a = 0 to 4 step 1
    $result = _ImgSearch($Bild[$a])
    If $result<>0 Then
        MsgBox(0, "Der Wert ist:", $a)
        exitloop(2)
    EndIf
Next

	Switch $a
    Case 1
		WinWaitActive("[CLASS:TSplashScreen]",$Button[0])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",5)
	Case 2
		WinWaitActive("[CLASS:TSplashScreen]",$Button[1])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",4)
	Case 3
		WinWaitActive("[CLASS:TSplashScreen]",$Button[2])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",3)
	Case 4
		WinWaitActive("[CLASS:TSplashScreen]",$Button[3])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke",2)
	Case 5
		WinWaitActive("[CLASS:TSplashScreen]",$Button[4])
        Sleep (2000)
        Send("{ENTER}")
	    MsgBox(0,"Drücke", 1)
EndSwitch
Exit  

 Func _ImgSearch($sPic, $iTimeout = 1, $bClick = 1, $iTol = 5)
     Local $iX = 0, $iY = 0, $bResult = 0, $iTimer = TimerInit()
     $aPics = StringRegExp($sPic, '([^|]+)', 3)

     While TimerDiff($iTimer) < $iTimeout
         For $i = 0 To UBound($aPics) - 1
             $bResult = _ImageSearch(@ScriptDir & "/Data/" & $aPics[$i] & ".bmp", 1, $iX, $iY, $iTol)
             If $bResult = 1 Then ExitLoop(2)
             Sleep(50)
         Next
     WEnd
         

     Return $bResult
 EndFunc   ;==>_ImgSearch
Vierus.exe is offline  
Old 06/20/2011, 17:06   #26
 
elite*gold: 0
Join Date: Jun 2011
Posts: 67
Received Thanks: 4
Talking

:c ool:

DANKE dir Reeek

imp:

ich habs jetzt soll ichs Veröffentlichen?
MfG

Vierus
Vierus.exe is offline  
Old 06/20/2011, 23:13   #27
 
Reeek's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 1,304
Received Thanks: 485
gute Arbeit wieso nicht, hau's rein und gug, obs irgendwer braucht - wenn nicht ist auch egal
Reeek is offline  
Reply


Similar Threads Similar Threads
Suche EQ/Yang/Accounts auf Leviathan oder Sobo oder SG (S.25 oder 21)
06/27/2011 - Metin2 Trading - 4 Replies
Wie der Titel bereits sagt. Suche Sachen auf Leviathan, Sobo oder Metin2.Sg Bezahle mit Paypal oder auf Wunsch extra mit Paysafecards. Msged mich oder addet mich in Skype: krixxon Verhandelt wird mit einem Mod oder Middleman.
Hat jemand ein programm für anti smoke oder anti flash oder m14 oder crosshair..sry
02/23/2011 - WarRock - 6 Replies
hat jemand ein programm für anti smo0ke anti flash anti m14 mine oder crosshair wenn ja hier rein psoten und gibt thx sry für dieses thread
[S] Gamecard 60 Tage [B] PSC oder Gold oder Keys oder Amazon Gutscheine
11/29/2010 - World of Warcraft Trading - 7 Replies
Gamecard 60 Tage 25€ PSC oder Gold auf allen servern oder Keys oder Amazon Gutscheine 40€ einfach mal bieten :) habe keys von classic bis cata von cata aber nur 2 vorbestellte :D



All times are GMT +2. The time now is 14:32.


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.