vamp1repk Posted November 14, 2021 Share 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 Link to comment Share on other sites More sharing options...
Subz Posted November 14, 2021 Share 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. Link to comment Share on other sites More sharing options...
ad777 Posted December 3, 2021 Share 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 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
mikell Posted December 3, 2021 Share Posted December 3, 2021 As said @Subz .... ToolTip(StringInStr(FileRead("list.txt"), $life) ? "number is in list" : "number is not in list", 0, 0) Link to comment Share on other sites More sharing options...
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