Jump to content

Need help with file read and comparing


 Share

Recommended Posts

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

  • 3 weeks later...
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...