vamp1repk Posted November 14, 2021 Posted November 14, 2021 Hi guys, i'm struggling with a small code concerning fileread. if got a file with losts of numbers and i want to do a "pixelgetcolor" on screen and check if the colornumber is in the list of numbers in the file... but i dont know how to make "the check"... someone got an idea? i tried with this Func check() $file = FileOpen("list.txt") $life = PixelGetColor(500,850) $read = FileRead($file) If $read = $life Then ;__________________ this should happen: ToolTip("numer is in list",0,0) Else ToolTip("number is not in list",0,0) EndIf EndFunc
Subz Posted November 14, 2021 Posted November 14, 2021 Use FileRead to read the file to a string and then use something like StringInStr to find the number within the string.
ad777 Posted December 3, 2021 Posted December 3, 2021 On 11/14/2021 at 2:23 PM, vamp1repk said: Hi guys, i'm struggling with a small code concerning fileread. if got a file with losts of numbers and i want to do a "pixelgetcolor" on screen and check if the colornumber is in the list of numbers in the file... but i dont know how to make "the check"... someone got an idea? i tried with this Func check() $file = FileOpen("list.txt") $life = PixelGetColor(500,850) $read = FileRead($file) If $read = $life Then ;__________________ this should happen: ToolTip("numer is in list",0,0) Else ToolTip("number is not in list",0,0) EndIf EndFunc this should work☺️ #include <File.au3> $FileLine = FileReadToArray("list.txt") $Lines = @extended $life = 50 If IsArray($FileLine) Then For $i = 1 To $Lines Step 1 Local $path = StringInStr(FileReadLine("list.txt",$i), 50) if $path Then ToolTip("number is in list",0,0) FileWriteLine("list.txt",$path) ExitLoop Else ToolTip("number is not in list",0,0) EndIf Next EndIf none
mikell Posted December 3, 2021 Posted December 3, 2021 As said @Subz .... ToolTip(StringInStr(FileRead("list.txt"), $life) ? "number is in list" : "number is not in list", 0, 0)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now