Hey,
ich habe mir versucht ein kleines Script zu schreiben, welches für mich Icons auf dem Desktop verschiebt (kA wieso aber meine Icons machen sich beim hochfahren des Rechners immer selbstständig..) Nun habe ich auch alles soweit hinbekommen, nur leider stellt sich folgendes Problem:
Ich lasse das Script nach einem variablen Bild suchen. Folgender Maßen: Das Bild wird in den Script-Ordner getan und Icon1-Icon10 genannt. Nun soll das Script mit Hilfe von ImageSearch nach diesen Icons suchen und sie an die entsprechende vordefinierte Stelle vom Desktop bewegen. Leider hängt es genau da -.-' Alles funktioniert einwandfrei, auch wenn ich folgender maßen die Daten ausgeben lasse :
[autoit]MsgBox(64,"Info","Gesuchtes Icon: Icon"&$t&".bmp")
[/autoit]
wobei "t" für die entsprechende Zahl steht.
Hier der ganze Code:
Spoiler anzeigen
#include <ImageSearch.au3>
#include <Array.au3>
HotKeySet("{NUMPADSUB}","Ende")
Sleep(2000)
Dim $x=664
Dim $y=346
Dim $x1=0
Dim $y1=0
Dim $S1=498 ;~ Desktop Wunsch Platz X-Koord
Dim $S2=360 ;~ Desktop Wunsch Platz Y-Koord
$u=0
$t=1
Do
For $i = 0 to 39
Sleep(50)
If ($i=5) OR ($i=10) OR ($i=15) OR ($i=20) OR ($i=25) OR ($i=30) OR ($i=35) OR ($i=40) Then
$y=$y+32
$S2=$S2+32
$x=696
$S1=530
Sleep(100)
$res=_ImageSearchArea("Icon"&$t&".bmp",1,$x,$y,$x+25,$y+25,$x1,$y1,10)
If $res = 1 Then
$u=$u+1
MouseMove($x1,$y1,0)
Sleep(1000)
MouseMove($S1,$S2,0)
Sleep(1000)
EndIf
Else
$x=$x+32
$S1=$S1+32
Sleep(100)
$res=_ImageSearchArea("Icon"&$t&".bmp",1,$x,$y,$x+25,$y+25,$x1,$y1,10)
If $res = 1 Then
$u=$u+1
MouseMove($x1,$y1,0)
Sleep(1000)
MouseMove($S1,$S2,0)
Sleep(1000)
EndIf
EndIf
TrayTip("Momentane Position","Versuch: "&$i&", Position X: "&$x&", Position Y: "&$y,2) ;~ dient nur der Übersicht während dem laufendem Script
Next
If $res=0 Then
$y=346
$S2=360
$t=$t+1
EndIf
Until $t=10
Func Ende()
Exit
EndFunc
Warum funktioniert das nicht? Wie gesagt wenn ich die Icon Nr mit ner MsgBox ausgeben lasse funktionierts...aber das Script sucht nicht nach Icon1-10 warum nicht?
Pls help
Wong