Created
November 6, 2013 14:56
-
-
Save anonymous/7337367 to your computer and use it in GitHub Desktop.
Parse a sentence into individual words to display until delimiter character. Loops until end. Error occurs at line 48 I need a loop break in there too on a keypress if possible.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim strText As String | |
Dim i As Integer | |
Dim x As Integer | |
Dim LenTextLeft As Integer | |
Dim CriticalCounter As Integer | |
'Read the TotalText attribute into a string variable and determine the length | |
strText = c.GetAttrib("TotalText") | |
LenTextLeft = Len(strText) | |
' While there is text left, look for the delimiter character and | |
' break up the text into sections based on that character. | |
' Note: Text must include a delimiter character at the end. | |
CriticalCounter = 0 | |
i = 0 | |
Debug.Print i & "\t" & c.GetAttrib("Condition") & "\t" & CriticalCounter & "\t" & x & "\t" & strText & "\n" | |
Do | |
i = i+1 | |
x = InStr(1, Mid$(strText, 1,LenTextLeft), strDelimChar) | |
If x = 0 Then | |
x = InStr(1, Mid$(strText, 1,LenTextLeft), strEndChar)-0 | |
LenTextLeft = LenTextLeft -0 | |
End If | |
If left$(strText,1) = "#" Then | |
x=x-1 | |
LenTextLeft = LenTextLeft-1 | |
strText = Right$(strText, LenTextLeft) | |
CriticalCounter = 1 | |
LineList.SetAttrib i-4, "CriticalWord", -4 | |
LineList.SetAttrib i-3, "CriticalWord", -3 | |
LineList.SetAttrib i-2, "CriticalWord", -2 | |
LineList.SetAttrib i-1, "CriticalWord", -1 | |
Else | |
If left$(strText,1) = "*" Then | |
x=x-1 | |
LenTextLeft = LenTextLeft-1 | |
strText = Right$(strText, LenTextLeft) | |
CriticalCounter = 10 | |
Else | |
If CriticalCounter > 0 Then | |
CriticalCounter = CriticalCounter + 1 | |
End If | |
End If | |
End If | |
LineList.SetAttrib i, "CriticalWord", CriticalCounter | |
LineList.SetAttrib i, "TextLine", Mid$(strText, 1, x-1) | |
LenTextLeft = LenTextLeft-x | |
strText = Mid$(strText, x+1, LenTextLeft) | |
Loop While LenTextLeft > 0 | |
'The LineList must include the maximum number of lines for a text | |
'This script resets the LineList object to run the correct number of trials. | |
Set LineList.ResetCondition = Samples(i) | |
LineList.Reset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment