PslResData.GetEntryData
Get data of resource string. After calling ProcessEntry, you can obtain the resource text in the target language.
Syntax
Expression.GetEntryData (DataID as Integer) as String
Expression Object of type PslResData
DataID Indicates, what kind of data you want to retrieve:
pslResUpdId (Value = 0): Get the id of the resource entry.
pslResUpdText (Value = 1): Get the resource text of the resource entry.
pslResUpdCtrl (Value = 2): Get additional information about the resource entry.
PslResUpdTranslated (Value=3): Returns "1" if the resource entry is translated, otherwise the return value is "0".
Function TxtUpdate(rd As PslResData) As Long
Dim fso As Scripting.FileSystemObject, tsi As Scripting.TextStream
Dim tso As Scripting.TextStream
Dim s As String, i As Integer, delimiterpos As Integer
Set fso = New Scripting.FileSystemObject
Set tsi = fso.OpenTextFile(rd.SourceFile)
' Generating target file
If rd.Action = pslResUpdGenerate Then
Set tso = fso.CreateTextFile(rd.TargetFile)
End If
rd.ProcessResource "Text File", "Textlist"
TxtUpdate = 0
On Error GoTo finish
While True
s = tsi.ReadLine
delimiterpos = InStr(s, "=")
If delimiterpos > 0 Then
rd.SetEntryData(pslResUpdId, Trim(Left(s, delimiterpos - 1)))
rd.SetEntryData(pslResUpdText, Trim(Mid(s, delimiterpos + 1)))
rd.SetEntryData(pslResUpdCtrl, "")
rd.ProcessEntry
' Generate changed line
If rd.Action = pslResUpdGenerate Then
s = CStr(rd.GetEntryData(pslResUpdId)) & " = " & _
rd.GetEntryData(pslResUpdText)
End If
End If
' Write data to target file
If rd.Action = pslResUpdGenerate Then
tso.WriteLine(s)
End If
Wend
finish:
End Function