Community
    • Login

    Loading preferences by file extension.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 4 Posters 899 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.
    • James SwallowJ
      James Swallow
      last edited by James Swallow

      Hello, thank you for the reply. The vertical edge settings are what I am trying to adjust by file. You got everything else correct. So I have:
      .def with spacing “A”,
      .ini with spacing “B”… etc
      Our team has hired some technician level associates in order to help us, so I have been trying to create visual boundaries in each “column” Realistically that is the only preference parameter that I need to come in with the file.
      I am manually loading them by replacing the appdata with a saved set from another instance.
      Best,
      Jim

      PeterJonesP EkopalypseE 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @James Swallow
        last edited by

        @James-Swallow said in Loading preferences by file extension.:

        The vertical edge settings are what I am trying to adjust by file

        Ah, okay, yes. Those settings should work with either the PythonScript or the batch workaround.

        if you want to go the PythonScript route, let us know. Otherwise, hopefully you have enough for the batch. (or you can wait to see if someone else has other suggestions).

        1 Reply Last reply Reply Quote 1
        • EkopalypseE
          Ekopalypse @James Swallow
          last edited by

          @James-Swallow

          see here for an example based on the language used.

          1 Reply Last reply Reply Quote 2
          • James SwallowJ
            James Swallow
            last edited by

            OK, So I got that script to run. A couple of questions:
            On Startup, is there a way to automate this so it will apply to open instances without changing the language and then changing back?
            Second question, What is the best way to run this with shortcuts if that is not an option?

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @James Swallow
              last edited by

              @James-Swallow said in Loading preferences by file extension.:

              On Startup, is there a way to automate this so it will apply to open instances without changing the language and then changing back?

              Interesting. I would have thought that BUFFERACTIVATED notification would trigger at Notepad++'s initial startup, too. But if the callback isn’t triggering, it’s probably not notified. There is a notification for “notepad++ has finished loading everything”: NPPN_READY, which in PythonScript is NOTIFICATION.READY. So if you add that to the list of notifications, it should work for you.

              Second question, What is the best way to run this with shortcuts if that is not an option?

              Hmmm. I think if you added a call to on_set_edge_config() (or whatever you called your version of the callback function) at the end of the script, then if you run the script manually, it will trigger the callback, even if the script was already run from startup.py. (I’m not 100% sure). If so, then use the PythonScript > Configuration… to add your script to the Menu Items. Then, after Notepad++ restart, you can assign as keyboard shortcut to that script using Settings > Shortcut Mapper > Plugin Commands and filtering for PythonScript to easily find your script’s name.

              Alan KilbornA 1 Reply Last reply Reply Quote 2
              • EkopalypseE
                Ekopalypse
                last edited by Ekopalypse

                Just a note that if you started your script via startup.py and call it again, you will get two callbacks registered doing the same thing, that would be unnecessary. And if you want to call it intially with on_set_edge_config(), do not forget to add a None parameter, because the function expects an args dictionary.

                Alan KilbornA 1 Reply Last reply Reply Quote 1
                • Alan KilbornA
                  Alan Kilborn @PeterJones
                  last edited by Alan Kilborn

                  @PeterJones said in Loading preferences by file extension.:

                  I would have thought that BUFFERACTIVATED notification would trigger at Notepad++'s initial startup

                  Yea, the fact that this doesn’t happen is a sometimes-annoying quirk. :-(

                  1 Reply Last reply Reply Quote 0
                  • Alan KilbornA
                    Alan Kilborn @Ekopalypse
                    last edited by

                    @Ekopalypse

                    So your best advice, as the script’s author, is to add a call to on_set_edge_config(None) in startup.py ?

                    1 Reply Last reply Reply Quote 1
                    • EkopalypseE
                      Ekopalypse
                      last edited by

                      @Alan-Kilborn

                      Yes, that’s what I usually do too, but I have to admit, npp_ready is also a nice solution too, since it’s only called once. As usual, there are more ways to Rome.

                      1 Reply Last reply Reply Quote 1
                      • James SwallowJ
                        James Swallow
                        last edited by

                        Thanks for all the input thus far. Much obliged!

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