Naše značky

Impact-Company-Logo-English Black-01-177x54

Vitajte na webovej lokalite spoločnosti Schneider Electric

Vitajte na našej webstránke.
		
Ako vám dnes môžeme pomôcť?
How to read text from a file in Vijeo Designer?
Issue:
Looking for a way to plug in a USB stick with a text file and have the ability to display the contents of the text file on the screen.

Product Line:
Vijeo Designer (all versions)

Resolution:
In Vijeo Designer, we are able to read a Unicode text file by using 3 simple script methods. Below is a breakdown of what is needed and how to put it all together.

Use the following methods to read from a Unicode text file (.txt) line-by-line. Please be certain that the text file's encoding is Unicode.

Method

Description

TextFile.open

Opens the text file at run time.

TextFile.readLn

Reads from the text file one line at a time.

TextFile.close

Closes the text file.

Example

The following example shows how to write a script to open, read, and close a text file at runtime.

String s; //Java string variable

int lineNum = 0;

TextFile.open("File1"); //File1 is the alias name of the text file

while(true)

{s= TextFile.readLn(); //returns the first 700 characters in the line

if (s==null) break;

STRING01[lineNum++].write(s); //STRING01 is a Vijeo Designer string array variable

}

TextFile.close();

  • Make sure that the string array variable (STRING01, in the above example) has enough elements to handle the number of lines in the text file. Use the NumOfBytes property of the array variable to set the length of the array elements. Note that the maximum number of characters a string variable can hold is 100 (i.e., NumOfBytes=100). If a single line contains the maximum of 700 characters, the last 600 will be truncated.

Schneider Electric Slovakia

Objavte viac
Rad:
Objavte viac
Rad:

Potrebujete pomoc?

  • Výber produktov

    Rýchlo a jednoducho nájdite tie správne produkty a príslušenstvo pre vaše aplikácie.

  • Získať ponuku

    Kontaktujte nás online a náš odborník sa s vami spojí.

  • Kde nakúpiť?

    Jednoducho nájdite najbližšieho distribútora produktov Schneider Electric vo vašom okolí.

  • Centrum podpory

    Nájdite zdroje podpory pre všetky vaše potreby na jednom mieste.

  • Produktová dokumentácia
  • Prevzatia softvéru
  • Nástroj pre výber produktov
  • Nahradenie a výmena produktu
  • Centrum nápovedy
  • Nájdite naše pobočky
  • Kde kúpiť
  • Kariéra
  • Profil spoločnosti
  • Nahlásiť pochybenie
  • Dostupnosť
  • Redakcia
  • Investori
  • EcoStruxure
  • Vyhľadať pracovné miesta
  • Blog
  • Zásady ochrany osobných údajov
  • Upozornenie o súboroch cookie
  • Zmluvné podmienky
  • Zmeniť nastavenia cookie