0

Is there a way to assign a string variable with the contents of a string from the GlobalTextList?

Also of import, when it assigns the variable from the GlobalTextList it uses the correct language from the GlobalTextList.

da66en
  • 275
  • 1
  • 11

2 Answers2

2

Do you want to get from static dynamic text list a string in ST?

This function will do it:

FUNCTION F_GetText : STRING
VAR_INPUT
    sTextList : STRING;
    sId : STRING;
END_VAR

sTextList := CONCAT('Port_851.',sTextList);
F_GetText := VisuElems.CmpDynamicText.DynamicTextGetText(
    pstTextList:= ADR(sTextList), 
    pstTextIndex:= ADR(sId)
    )^;
  • If its a static text, give as argument the number as STRING

  • If you are using TwinCAT this approach needs the license of HMI. Other option is though ADS and an external program to do the job.

Related post:

Codesys 3. How to get the translations from static or dinamic text file in ST?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
1

I was able to do solve this by using the TextListUtils library.

da66en
  • 275
  • 1
  • 11