Community
    • Login

    Set *.wri as default save extension

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 1.7k 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.
    • SchwabenGeizS
      SchwabenGeiz
      last edited by

      Hello everyone,

      I would like to set *.wri as a default save extension.
      Tried to change the langs.xml, but without success.

      BTW, I have created a user-defined language with default extension *.wri, but it is of course not listed in langs.xml. As soon as I manually save the file as XYZ.wri it gets highlighted as specified.

      Thank you in advance!

      Claudia FrankC 1 Reply Last reply Reply Quote 1
      • Claudia FrankC
        Claudia Frank @SchwabenGeiz
        last edited by

        @schwaben-github

        natively, afaik you can’t - but using a scripting language plugin you could easily
        workaround this, I guess. Simple example for python script

        filename = notepad.prompt('','Save as...','')
        notepad.saveAs(r'C:\{}.wri'.format(filename))
        

        Cheers
        Claudia

        SchwabenGeizS 1 Reply Last reply Reply Quote 2
        • SchwabenGeizS
          SchwabenGeiz @Claudia Frank
          last edited by

          Thanks for your help, Claudia!
          But, since I’m inexperienced regarding scripting, could you please detailed describe what you mean by that?
          Which plugin exactly should I use?
          And how should I use the snippet you wrote?

          I know, your answer could be something like “RTFM”, but since I’m tabula rasa… :)

          Thank you in advance!

          Claudia FrankC 1 Reply Last reply Reply Quote 1
          • Claudia FrankC
            Claudia Frank @SchwabenGeiz
            last edited by

            @schwaben-github

            so here is my quick-rtfm :-D

            • From plugin manager install python script plugin.
            • Once installed goto Plugins->Python Script->NewScript
            • In the save as dialog use a meaningful name for this script
            • paste the content I posted into the newly created document
            • modify the path part as needed and save
            • create a new document with your .wri code and once happy to save goto Plugins->Python Script and select the newly created scipt.

            It will popup an prompt which asks for the filename to be saved

            If this is a way for you - modifications like assigning a shortcut or changing the code
            to your needs can still be done afterwards.

            Cheers
            Claudia

            Scott SumnerS SchwabenGeizS 2 Replies Last reply Reply Quote 2
            • Scott SumnerS
              Scott Sumner @Claudia Frank
              last edited by

              @Claudia-Frank

              A huge missed FAQ Desk opportunity…

              :-(

              Of course it is easy for the person that to-date hasn’t authored ANY FAQ Desks himself to throw stones… :-)

              Claudia FrankC 1 Reply Last reply Reply Quote 1
              • Claudia FrankC
                Claudia Frank @Scott Sumner
                last edited by

                @Scott-Sumner

                to be honest Scott, personally, I don’t think the FAQ should contain plugin related stuff
                but on the other side … hmmm … I agree to write one if you correct my english beforehand. :-D

                So question - should plugin related stuff being FAQ’ed ??

                Cheers
                Claudia

                Scott SumnerS 1 Reply Last reply Reply Quote 0
                • Scott SumnerS
                  Scott Sumner @Claudia Frank
                  last edited by

                  @Claudia-Frank

                  Sure seems like anything that is repeated over and over in this Community is good FAQ Desk material, be it plug-in or whatever…but I have no authority on the final decision. :-)

                  But if it is a “go”, then:

                  I agree to collaborate with you; email me your FAQ Desk “release candidate” and I will edit and augment.

                  These links may help you not reinvent the wheel:

                  https://notepad-plus-plus.org/community/topic/10882/feature-request-copy-line-with-number/6
                  https://notepad-plus-plus.org/community/topic/14703/run-python-script-pythonscript-plugin-with-a-shortcut
                  https://notepad-plus-plus.org/community/topic/12077/opening-read-only-files

                  1 Reply Last reply Reply Quote 0
                  • SchwabenGeizS
                    SchwabenGeiz @Claudia Frank
                    last edited by

                    @Claudia-Frank
                    Great, thank you!
                    The post from @scott-sumner helped me to assign shortcut to the script
                    (https://notepad-plus-plus.org/community/topic/14703/run-python-script-pythonscript-plugin-with-a-shortcut)…

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