04-01-2022 05:15 PM
Hola amigos, quiero hacer un programa que haga lo siguiente:
Leer un arichivo .txt
Encontrar si el archivo contiene la palabra "Failed
Abrir el siguiente archivo y buscar la palabra "Failed"
Asi sucecivamente en una determinada carpeta
Para poder graficar cuantos arichivos contienen la palabra "Failed"
Pero no se como hacer que abra el siguiente archivo que este en la carpeta
Alguien me podria ayudar?
Adjunto el VI
Solved! Go to Solution.
04-01-2022 05:16 PM
Hello friends, I want to make a program that does the following: Read a .txt file
Find if the file contains the word "Failed
Open the following file and search for the word "Failed"
So successively in a certain folder
To be able to graph how many files contain the word "Failed"
But I don't know how to make it open the next file that is in the folder
Someone could help me? I attach the VI
04-01-2022 08:13 PM
Could you supply an example file? I think your analysis could be simplified quite a bit.
As far as going through the files, use the the List Folder function to get the list of txt files in a folder and run that array though a FOR loop to analyze each file.
04-04-2022 07:57 AM
Hi
I attached the example file
I think that like you say could be something simple, but a don't know how to start 🤔☹️
04-04-2022 09:35 AM - edited 04-04-2022 09:36 AM
I would just read the entire file and then use Search/Split String to find the line with the UUT Result.
04-04-2022 10:16 AM
Thanks!!!
Too much easier than I was thinking!
04-04-2022 01:55 PM
Hi friend!
I try to make the code, but my program don found the file, even initialize the For loop
Can you take a look?
04-04-2022 02:14 PM
1. Your pattern needs to be "*.txt". The * is a wildcard that can be any combination of characters. Since we put it at the front of the pattern, we are saying any file that ends in ".txt". As you have it, the List Folder will only return files actually named ".txt".
2. No need to wire up the N terminal on the FOR loop. The autoindexing tunnel will tell the FOR loop how many times to iterate.
3. No need to the wait inside of the loop. You are just slowing it down for no good reason.
04-04-2022 03:31 PM - edited 04-04-2022 03:43 PM
Got it!!
Now I'm trying to read different lines in the same file
Station DAQ
Status :Failed
Only if have this two conditions it will count
Sorry I found the solution! I just put another Search/Splie after then the 1st