I wanna do Find image on somewhere screen and write something to specific file. I dont have much experience.
If to be more descriptive; I have 3 image on screen but they are changes every 10 min or more I want it to check for image every 5 minutes. if X image there write X image appeared to file. if Y image there write Y image appeared to file. And after all of them i want to count which image how much time appeared. Like this.
I did something here.
#include <File.au3>
#include <ImageSearch2015.au3>
#RequireAdmin
HotKeySet("p", "baslat")
HotKeySet("{ESC}", "kapat")
Global $x=0,$y=0
$file = "deneme.txt"
$r= @ScriptDir & '\bu2.png'
$i = 0
Func baslat()
While 1
If _ImageSearch($r, 0, $x, $y, 20) = 1 Then
For $i = 1 to 10
Next
FileWrite("deneme.txt", $i)
Sleep(200)
$sStr = FileRead("deneme.txt")
$sStr = StringReplace("deneme.txt", $i, $i+1)
$oFile = FileOpen("deneme.txt", 2)
FileWrite($oFile,$i)
FileClose($oFile)
Else
EndIf
WEnd
EndFunc
Func kapat()
Exit 0
EndFunc
While 1
Sleep(200)
WEnd
Please check if the location of
Next
is correct in your question (I doubt it). AlsoStringReplace("deneme.txt", $i, $i + 1)
doesn’t look right. It probably should beStringReplace($sString, $i, $i + 1)
AndFileWrite($oFile,$i)
should probably beFileWrite($oFile,$sString)