GetStateText
(Engine-Level Function)
State |
Required. Any expression for the code value which defines the state. |
Mode |
Required. Any numeric expression for the desired information:Mode | Desired information |
---|
0 | Character offset to beginning of state definition from start of module (includes state name and square brackets enclosing state code). | 1 | Size of state in characters, including state name and square brackets. | 2 | Character offset to beginning of first statement from start of state. | 3 | Size of state code in characters, excluding state name and square brackets. |
|
Example:
If 1 Next;
[
{ The module and file for which to get state code }
ModVal = FindVariable("ConfigFolder", Scope(Code,
"AnalogInput"), 0, 0);
FStream = FileStream("C:\VTScada\VTS\AnalogInput.SRC");
{ Get the states and create an array in which to store their code }
SList = StateList(ModVal, 1);
Num = ArraySize(SList, 0);
CodeList = New(Num);
I = 0;
WhileLoop(I < Num,
StateOffset = GetStateText(SList[I], 0) +
GetStateText(SList[I], 2).
StateLength = GetStateText(SList[I], 3);
{ Read in the code contained in that state - don't include the square brackets }
Seek(FStream, GetModuleText(ModVal, 1) + StateOffset, 0);
StateCode[I] = BuffStream("");
BlockWrite(StateCode[I], FStream, StateLength);
Seek(StateCode[I], 0, 0);
I++;
);
CloseStream(FStream);
]
Trihedral and VTScada are registered trade marks of Trihedral Engineering Limited
© Trihedral Engineering Limited 1983- 2024 All rights reserved.