ElseIf not working...

ElseIf not working...

3

    Apr 20, 2006#1

    here's my wordfile (well, the important bit any way)

    /L15"VBScript" Line Comment = ' File Extensions = VBS WSF
    /Function String = "^{Sub^}^{Function^} [a-z,A-Z,0-9,_, ,(,)]+$"
    /Delimiters = .(),-+=|\/{}[]:;"'< >
    /Indent Strings = "Then" "Do" "For Each" "For" "Else" "ElseIf"
    /Indent Strings SOL = "For" "Do" "Select Case" "Case"
    /Unindent Strings = "End" "Next" "Else" "ElseIf" "End If" "End Select" "End Sub" "Wend" "Loop" "Case Else" "Case"

    Delimiters contains <TAB> and <space>

    Here's my code:

    Code: Select all

    If blnFoundFile=0 Then
    	strRes=200
    ElseIf blnFoundSect=0 Then
    	strRes=201
    ElseIf strValue="*" Then
    	strRes=split(strList,"|")
    ElseIf blnNextSect=1 Then
    	strRes=202
    Else
    	strRes=Right(strData,Len(strData)-InStr(strData,"="))
    End If
    'Wscript.echo strRes,strSection,strValue,strIniFIle
    ReadIniFile=strRes
    On Error Resume Next
    objIniFile.Close
    On Error GoTo 0
    End Function
    It *should* look like the above, but the unindent for ElseIf does not happen, so i get this:

    Code: Select all

    If blnFoundFile=0 Then
    	strRes=200
    	ElseIf blnFoundSect=0 Then
    		strRes=201
    		ElseIf strValue="*" Then
    			strRes=split(strList,"|")
    			ElseIf blnNextSect=1 Then
    				strRes=202
    			Else
    			strRes=Right(strData,Len(strData)-InStr(strData,"="))
    		End If
    		'Wscript.echo strRes,strSection,strValue,strIniFIle
    		ReadIniFile=strRes
    	On Error Resume Next
    	objIniFile.Close
    	On Error GoTo 0
    End Function
    I have played with this for ages, and I have no clues why it fails.

    The other problem is that Else and ElseIf should unindent their own line and then indent the next one - this doesn't work either.

    I realized that else and elseif are in both indent and unindent, but the problem still remains if I take them out of unindent.

    Any suggestions? Thanks in advance.

    20
    Basic UserBasic User
    20

      Apr 20, 2006#2

      <snip> ...
      /Indent Strings = "Then" "Do" "For Each" "For" "Else" "ElseIf"
      /Indent Strings SOL = "For" "Do" "Select Case" "Case"
      /Unindent Strings = "End" "Next" "Else" "ElseIf" "End If" "End Select" "End Sub" "Wend" "Loop" "Case Else" "Case"
      ... </snip>
      ElseIf seems to be both a indent and a unindent string. Could this be the problem?
      A source of incoherent bullshit since 1986

      3

        Apr 21, 2006#3

        unfortunately, it's not that (I wish it was!) If you put them in unindent it makes no difference. The best I can make it do is half-work with them in Unindent.

        6,613550
        Grand MasterGrand Master
        6,613550

          Apr 22, 2006#4

          I can't reproduce it with UE v11.20a. I used standard wordfile.txt which already contains /L2"Visual Basic" for VBS files. I replaced the first part of the language definition with your settings and the indent mechanism works perfect. ReIndent Selection and auto-indent during entering the code produces the result of your first example.

          After opening a VBS file look at View - View As (Highlight File Type). Does UE apply really language definition 15 with the name "VBScript" to the current VBS file? If not, you have a duplicate VBS file extension assignment in your wordfile.
          Best regards from an UC/UE/UES for Windows user from Austria

          20
          Basic UserBasic User
          20

            Apr 22, 2006#5

            Now you put some code tags around your code it is easier to see what you mean. Try removing "elseif" from the unindent collection and that would do the trick.
            A source of incoherent bullshit since 1986

            3

              Apr 23, 2006#6

              Mofi wrote:I can't reproduce it with UE v11.20a. I used standard wordfile.txt which already contains /L2"Visual Basic" for VBS files. I replaced the first part of the language definition with your settings and the indent mechanism works perfect. ReIndent Selection and auto-indent during entering the code produces the result of your first example.

              After opening a VBS file look at View - View As (Highlight File Type). Does UE apply really language definition 15 with the name "VBScript" to the current VBS file? If not, you have a duplicate VBS file extension assignment in your wordfile.
              Erm, not sure what's going on, but it is fixed now. It was highlighted as Language 15, then I saw VBSCRIPT ASP, and viewed it as that language, and it was OK after a reindent. I copied the indent and unindent lines over to L15 and it works OK. bizarrely, if i paste back in my original L15 section as posted, it also works......bizarre.

              Thanks for the suggestion.