Unofficial Nextion/TJC User Forum

Read files on nextion editor

How to read a file on editor?
How to select the content of a line and assign it to a text variable?

Only the intelligent P-series Nextions can open and read files from the SD-card. There is a FileStream component for that in the component toolbox of the editor. For more details about using the latter, you should have a look onto the Nextion Editor Guide.

Io dispongo di un modello della serie intelligente infatti. Sai anche come assegnare al testo di una variabile il contenuto di una specifica riga del file txt?

I have an intelligent display. Do you know how to assign to the text of a vrariable (txt, botton…) the content of a specific line of my file( the file is a .txt file)?

Hi Silviaveg,
for read a file from the SDcard you must use the “filestream” component.
Using Open, Find and Read methods you can read part of the informations inside the txt file and put them into a variable.
first of all open the file eg.“sd0/file.txt”)
then search inside your file the the data of your interests, eg Pointer.val=fs0.find(“Color=”)
the “find” function returns the pointer value, you’ll use this value as starting point to read the data, eg.,Pointer.val,5)

Ciao Silviaveg,
per leggere i file presenti su una SDCARD devi usare il componente “Filestream”.
Prima di tutto devi aprire il file es.“sd0/file.txt”)
poi cerchi nel file la parte di testo che ti interessa es. Pointer.val=fs0.find(“Color=”)
la funzione “find” ti ritorna la posizione del puntatore che userai per indicare alla funzione read da dove iniziare a leggere, eg.,Pointer.val,5)

It looks like the following blog post on the Nextion website could be helpful for you:

This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).