• Login
Community
  • Login

Select predefined parameter strings for .ini Files

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 4 Posters 2.8k 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.
  • D
    dog fish
    last edited by dog fish Mar 8, 2019, 8:08 AM Mar 8, 2019, 8:08 AM

    Hello everyone!

    i am working in Software Development, where we just discussed about a ways to facilitate our usability for customers. We are extremely reliant on .ini Files, almost all of our settings are written down in .ini Files.

    So i’d like to ask if something like an auto-selection for parameters in .ini Files is possible for Notepad++.

    For example, you have an .ini file like this:

    test.ini

    parameter1=
    parameter2=
    parameter3=

    So, for parameter1, you can click behind the “=” mark, type “TAB”, there is a group of proposals for this parameter, let’s say the strings “None”, “Full”, “Periodic”. You can write down the possible strings associated to this parameter in an *xml file.

    Is there any Notepad++ solution for this? Or maybe a plugin which can realize this?

    All the best,

    Dog Fish

    M 2 Replies Last reply Mar 8, 2019, 9:29 AM Reply Quote 0
    • A
      andrecool-68
      last edited by Mar 8, 2019, 9:03 AM

      Test the plugin snippet, I think it will suit you for these purposes

      1 Reply Last reply Reply Quote 1
      • M
        Meta Chuh moderator @dog fish
        last edited by Meta Chuh Mar 8, 2019, 9:54 AM Mar 8, 2019, 9:29 AM

        @dog-fish

        if you meant, that you want to type the letters TAB, and you get an autocomplete list, where you select your parameter (your choice of being with or without double-quotes) and it will replace the letters TAB, once you double click on a proposed option:

        yes, you can do that yourself with the built in user defined languages (udl) which produces the result you can see at the screenshot below.

        Imgur

        you will have to create a new custom udl at language > define your language > create new, with the colours and keywords, etc of your choice.
        in this example i named the udl INI (AutoComplete)

        then save this xml code to YourPathTo\Notepad++\autoCompletion\INI (AutoComplete).xml.
        note: the .xml file has to be given the exact name as your udl, plus the .xml file extension

        <?xml version="1.0" encoding="Windows-1252" ?>
        <!--
        @title:		INI (AutoComplete).xml
        @author:	The Notepad++ Community - https://notepad-plus-plus.org/community/
        @version:	19.3.8
        -->
        <NotepadPlus>
        	<AutoComplete>
        		<KeyWord name='TAB None'/>
        		<KeyWord name='TAB Full'/>
        		<KeyWord name='TAB "Periodic"'/>
        	</AutoComplete>
        </NotepadPlus>
        

        feel free to play around with it.
        it’s best if you try out some udl features and options for a while to get a basic grip of udl, as this will help you asking your next questions with more knowledge and maybe even more ideas that might come up while testing.

        also because if you don’t really need the letters TAB, and just use them to trigger the suggestions, it could be better to autocomplete the words None, Periodic and Full directly, e.g. typing an F to show Full as option, as well as anything else that starts with an F you might need.

        (unless you want to force-categorise, so the letters TAB will suggest all possible TAB options only, and another category, let’s name it POP, will show only options relevant for POP)

        1 Reply Last reply Reply Quote 2
        • D
          dog fish
          last edited by Mar 8, 2019, 9:57 AM

          Thank you for this detailed answer! Sorry, i meant “press TAB” not “type TAB” , i think that was a bit confusing for you.

          M 1 Reply Last reply Mar 8, 2019, 10:11 AM Reply Quote 0
          • M
            Meta Chuh moderator @dog fish
            last edited by Mar 8, 2019, 9:58 AM

            @dog-fish

            additional note:
            if you don’t need any custom colouring or highlighting, and the default built in INI File highlighter suits your needs as it is, you can also save the autoCompletion code from above as ini.xml to your autoCompletion folder.

            1 Reply Last reply Reply Quote 0
            • M
              Meta Chuh moderator @dog fish
              last edited by Meta Chuh Mar 8, 2019, 10:26 AM Mar 8, 2019, 10:11 AM

              @dog-fish

              Thank you for this detailed answer! Sorry, i meant “press TAB” not “type TAB” , i think that was a bit confusing for you.

              yes it was, but who knows, we get all kinds of requests ;-)

              in this case, i would suggest not to do it with a tab key, but with a complete line auto completion.
              this is usually faster, as you just type the first few letters, e.g. para, and it will give you your defined options for the whole line, as seen at the screenshot below:

              Imgur

              another reason is, because we can not use [tab] key as a trigger for the built in autocompletion suggestion list.

              the new INI (AutoComplete).xml code template (or ini.xml code template, if you are satisfied with the built in ini highlighter) would be:

              <?xml version="1.0" encoding="Windows-1252" ?>
              <!--
              @title:		INI (AutoComplete).xml
              @author:	The Notepad++ Community - https://notepad-plus-plus.org/community/
              @version:	19.3.8b
              -->
              <NotepadPlus>
              	<AutoComplete>
              		<KeyWord name='parameter1="None"'/>
              		<KeyWord name='parameter1="Periodic"'/>
              		<KeyWord name='parameter1="Full"'/>
              		
              		<KeyWord name='parameter2="None"'/>
              		<KeyWord name='parameter2="Periodic"'/>
              		<KeyWord name='parameter2="Full"'/>
              	</AutoComplete>
              </NotepadPlus>
              

              as an alternative, you can try out the Snippets plugin, as suggested by @andrecool-68 .
              it is available at the built in plugins > plugins admin menu, if you are on notepad++ 7.6 to 7.6.4.
              but configuring this plugin will be more work.
              https://nppsnippets.readthedocs.io/en/latest/

              1 Reply Last reply Reply Quote 1
              • A
                Alan Kilborn
                last edited by Mar 8, 2019, 1:13 PM

                @Meta-Chuh said:

                if you meant, that you want to type the letters TAB

                LOL. That interpretation is just INSANE. :)

                M 1 Reply Last reply Mar 8, 2019, 1:20 PM Reply Quote 1
                • M
                  Meta Chuh moderator @Alan Kilborn
                  last edited by Meta Chuh Mar 8, 2019, 1:20 PM Mar 8, 2019, 1:20 PM

                  @Alan-Kilborn

                  type “TAB”

                  it would be less fun, if i’d stop treating requests completely literarily from time to time 😉

                  also it’s a nice playground, as the notepad++ autocompletion has this nice function to actually replace the typed place holder, as soon as a selection is made.

                  1 Reply Last reply Reply Quote 1
                  • D
                    dog fish
                    last edited by Mar 12, 2019, 7:55 AM

                    @Meta-Chuh said:

                    it would be less fun, if i’d stop treating requests completely literarily from time to time 😉
                    also it’s a nice playground, as the notepad++ autocompletion has this nice function to actually replace t

                    Hey, i just tried it out and i must say that it did unfortunately not work out. Here are the things i tried:

                    -Created a UDL named “AutoIni” and exported the language as an *.xml file in C:\Program Files (x86)\Notepad++\autoCompletion
                    -Settings --> Preferences --> Auto-Completion: Checked “Function completion”
                    -Selected the correct language in Notepad++

                    Also, i tried some additional things like adapting the ending of a file to .AutoIni and copied the .xml File in the same directory as the .AutoIni file

                    Which Notepad++ Version / Windows Version did you use for your example? Mine is Windows10 Pro and Notepad++ Version 7.6.4

                    1 Reply Last reply Reply Quote 0
                    • D
                      dog fish
                      last edited by Mar 12, 2019, 8:41 AM

                      okay now i reinstalled x64 and it works, thank you issue is solved!

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