Jump to content

Recommended Posts

Posted

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

 

 

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

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
  • Recently Browsing   0 members

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