• Login
Community
  • Login

VB script function list

Scheduled Pinned Locked Moved General Discussion
9 Posts 5 Posters 5.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Jiří Basler
    last edited by Nov 27, 2020, 10:58 AM

    Please, did anyone write a function list for the visual basic script? The old functionList.xml no longer works in the new version of N ++ ;-().

    K 1 Reply Last reply Nov 6, 2024, 6:04 AM Reply Quote 0
    • J
      Jiří Basler
      last edited by PeterJones Nov 6, 2024, 2:18 PM Nov 27, 2020, 12:04 PM

      I made file vbs.xml:

      <?xml version="1.0" encoding="UTF-8" ?>
      <!-- ==========================================================================\
      |
      |   To learn how to make your own language parser, please check the following
      |   link:
      |       https://npp-user-manual.org/docs/function-list/
      |
      \=========================================================================== -->
      <NotepadPlus>
        <functionList>
          <!-- ========================================================== [ VBS ] -->
      
          <!--
          |   Based on:
          |       http://sourceforge.net/p/notepad-plus/patches/613/
          \-->
          <parser
            displayName="Visual Basic (.NET|Script|for Applications)"
            id         ="vb_function"
            commentExpr="(?m:((?&lt;=&apos;).*?$)|((?i:REM)([\t ].*?)?$))"
          >
           <classRange
              mainExpr="(?s:(?&lt;SCOPE&gt;(?i:CLASS|TYPE)).*?(?i:END[\t ]\k&lt;SCOPE&gt;))"
              displayMode="node" >
            <className>
              <nameExpr expr="(?i:CLASS|TYPE)[\t ]+(?:[A-Za-z_][\w]*\b)(?:.*?[\r\n])" />
              <nameExpr expr="[\t ]+(?:[A-Za-z_][\w]*\b)" />
              <nameExpr expr="[A-Za-z_][\w]*" />
            </className>
            <function
              mainExpr="(?m:^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|SHARED|SHADOWS|OVERRIDABLE|OVERRIDES|READONLY|WRITEONLY)[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$))" >
              <functionName>
                <funcNameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:STATIC[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
                <funcNameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
                <funcNameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?=[\t ]*\()"/>
              </functionName>
            </function>
          </classRange>
          <function
              mainExpr="^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"
              displayMode="$functionName">
            <functionName>
            <nameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(?:ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
              <nameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
              <nameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?i:[\t ]+(LIB|ALIAS)[\t ]+[\w&quot;\.]+)*(?=[\t ]*\()"/>
            </functionName>
          </function>
          </parser>
        </functionList>
      </NotepadPlus>
      
      P 1 Reply Last reply Nov 27, 2020, 6:35 PM Reply Quote 0
      • J
        Jiří Basler
        last edited by Nov 27, 2020, 3:31 PM

        I reverted to version 7.8.6 now ;-()
        All OK…

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones @Jiří Basler
          last edited by Nov 27, 2020, 6:35 PM

          @Jiří-Basler ,

          You were actually pretty close.

          The old functionList.xml never had a pre-defined VB parser (that I can find in any of my old version zipfiles), so yours is apparently one that you added at some point.

          Looking in old functionList.xml, the language ID constant is 18 for L_VB, which is the language constant for Language > V > Visual Basic.

          Looking in the new overrideMap.xml,

          			<association id= "vb.xml"			 langID= "18"/>
          

          … that same language appears to want vb.xml as the filename, not vbs.xml. To get it to work in v7.9.1, you would either need to rename your file from vbs.xml to vb.xml, or you would need to move the line I showed out of the comment section, and change it to

          			<association id= "vbs.xml"			 langID= "18"/>
          

          … to match your filename, something like:
          5973d5ac-9187-4d4d-8cc7-cc9a409ab866-image.png

          P 1 Reply Last reply Nov 27, 2020, 6:43 PM Reply Quote 1
          • T
            TroshinDV
            last edited by Nov 27, 2020, 6:41 PM

            @Jiří-Basler said in VB script function list:

            I reverted to version 7.8.6 now ;-()

            I have another solution.
            I wrote a lot of development scripts for myself.
            They are in this repository. https://github.com/trdm/jn-npp-scripts
            There is also navigation through the VBS functions.
            alt text

            1 Reply Last reply Reply Quote 1
            • P
              PeterJones @PeterJones
              last edited by PeterJones Nov 27, 2020, 6:44 PM Nov 27, 2020, 6:43 PM

              @Jiří-Basler ,

              Yes. When I saved a file from this site as tryFunctionList.vb, and saved your vbs.xml as %AppData%\notepad++\functionList\vb.xml (note that it’s vb.xml), then reloaded Notepad++, the Function List displayed:

              29ed23ca-1ed0-40c9-96b9-8ba53785a4ea-image.png

              Similarly, if I renamed it to vbs.xml, edited overrideMap.xml to match the screenshot from my previous post,

              … then exited and re-entered Notepad++, it also parsed the VB function list as shown.

              Either of my suggestions worked for me.

              1 Reply Last reply Reply Quote 2
              • K
                Kanesaga @Jiří Basler
                last edited by PeterJones Nov 6, 2024, 1:53 PM Nov 6, 2024, 6:04 AM

                @Jiří-Basler In recent versions of Notepad++, the functionList.xml structure may have changed, leading to compatibility issues with older files. The functionList.xml file typically specifies how Notepad++ recognizes functions for various languages, including Visual Basic Script (VBScript). Here’s how you can create or update a functionList.xml for VBScript in the latest version of Notepad++.

                Steps to Create/Update a Custom functionList.xml for VBScript
                Locate the Function List Folder:

                Go to Notepad++'s installation directory.
                Open the functionList folder (usually located at C:\Program Files\Notepad++\functionList).
                Create a New functionList.xml (or Update It):

                If the functionList.xml file exists, open it.
                If it doesn’t exist, you can create a new one specifically for VBScript.
                Edit the functionList.xml for VBScript: Use the following template to recognize Function, Sub, and Property declarations in VBScript.

                A 1 Reply Last reply Nov 6, 2024, 11:09 AM Reply Quote -1
                • A
                  Alan Kilborn @Kanesaga
                  last edited by Nov 6, 2024, 11:09 AM

                  @Kanesaga said in VB script function list:

                  Open the functionList folder (usually located at C:\Program Files\Notepad++\functionList).
                  Create a New functionList.xml (or Update It):
                  If the functionList.xml file exists, open it.
                  If it doesn’t exist, you can create a new one specifically for VBScript.
                  Edit the functionList.xml for VBScript: Use the following template to recognize Function, Sub, and Property declarations in VBScript.

                  There are already instructions for “Function List” in the user manual, and those are way less vague than what you’ve described here, so I’d dub your posting of no value (sorry).

                  P 1 Reply Last reply Nov 6, 2024, 1:59 PM Reply Quote 2
                  • P
                    PeterJones @Alan Kilborn
                    last edited by PeterJones Nov 6, 2024, 2:11 PM Nov 6, 2024, 1:59 PM

                    To future readers,

                    To expand on what @Alan-Kilborn said,

                    There are already instructions for “Function List” in the user manual

                    @Kanesaga’s post was not only probably trying to spam (I just deleted the poorly-inserted link – to a site completely unrelated to Notepad++ or FunctionList – which fortunately, the anti-spam measures prevented from being a hidden link), but also appears to be the instructions for the pre-v7.9.1 single-functionList.xml, instead of for the v7.9.1-and-newer that the original poster was asking about 4 years ago.

                    Please understand that the instructions given in that recent post are out of date, and will not work on modern Notepad++ versions. As was said four years ago, the answer to the original question was just a slight tweak to the overrideMap.xml file.

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors