Community
    • Login

    NppExec v0.6.2 has been released!

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    6 Posts 3 Posters 1.1k Views 1 Watching
    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.
    • Vitaliy DovganV Offline
      Vitaliy Dovgan
      last edited by guy038

      NppExec v0.6.2:

      • changed: now NppExec uses CreateFile+FILE_FLAG_WRITE_THROUGH while writing
        files to avoid filling with zero bytes on system shutdown.
      • changed: now NppExec changes the current directory to %TEMP% when an unnamed
        file (such as “new 1”) is activated and “Follow $(CURRENT_DIRECTORY)” is on.
        To revert to the old behavior (the current directory is not changed when an
        unnamed file is activated), set the manual option “Cd_UnnamedFile” to 0.
      • added: now NppExec supports “cloud location path” in Notepad++'s settings.
        With cloud location path specified in Notepad++'s settings, NppExec does
        the following:
        • On start, NppExec tries to read its configuration files from the cloud
          location path. If these files do not exist or are filled with NULs,
          NppExec reads its configuration from $(PLUGINS_CONFIG_DIR).
        • When NppExec saves its configuration files, first they are saved to
          $(PLUGINS_CONFIG_DIR) and then copied to the cloud location path. Thus,
          NppExec always has copies of its current configuration files within the
          $(PLUGINS_CONFIG_DIR) folder.
        • NppExec’s saved scripts - the “npes_saved.txt” file - are monitored in
          the cloud location path. So, if you manually edit the “npes_saved.txt”
          within the cloud location, NppExec detects it. If, however, you manually
          edit the “npes_saved.txt” within the $(PLUGINS_CONFIG_DIR) folder, it is
          ignored.
          When the cloud location path is not specified in Notepad++'s settings,
          NppExec reads and stores its configuration within $(PLUGINS_CONFIG_DIR).
          And the “npes_saved.txt” is monitored in that folder.
      • added: $(NPP_FULL_FILE_PATH), $(CLOUD_LOCATION_PATH)
      • added: indirect variable reference, e.g. $($(name)). Examples:
        set local c = 123 // $(c) = 123
        set local b = c // $(b) = c
        set local a = $($(b)) // $(a) = $($(b)) = $(c) = 123
        set local $($(b)) = 456 // $(c) = 456
        unset local $($(b)) // deletes $(c)
        set local i = # // $(i) = #
        set local j = 1 // $(j) = 1
        echo $($(i)$(j)) // echo $(#1)
      • changed: now the variables $(ARGC), $(ARGV), $(ARGV[1]) and so on support
        the indirect variable reference (see above)
      • added: Ctrl+Break in the Console aborts the currently running script

      As always, get it either here:
      https://github.com/d0vgan/nppexec/releases/tag/v062
      or here:
      https://sourceforge.net/projects/npp-plugins/files/NppExec/NppExec Plugin v0.6.2/

      Have fun!

      Michael VincentM 2 Replies Last reply Reply Quote 6
      • Michael VincentM Offline
        Michael Vincent @Vitaliy Dovgan
        last edited by

        @Vitaliy-Dovgan said in NppExec v0.6.2 has been released!:

        NppExec v0.6.2:

        Already installed and experimenting. I like the indirect variable references - probably need to relook at some of my scripts - I know that would have come in handy in the past.

        Thanks for continued support of this great plugin!

        Cheers.

        1 Reply Last reply Reply Quote 2
        • guy038G Offline
          guy038
          last edited by

          Hello, @vitaliy-dovgan and All,

          As administrator, I took the liberty to modify slightly your post, because of a side-effect of the Markdown syntax !

          Indeed, when you write :

          set local c = 123 // $(c) = 123
          

          we get this sentence:

          set local c = 123 // $© = 123

          And so, I modified this sentence, and the other ones containing $(c), with :

          set local c = 123 // $\(c\) = 123
          

          which correctly displays :

          set local c = 123 // $(c) = 123


          Many thanks for your continued support and enhancements of this main N++ plugin !

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 3
          • Michael VincentM Offline
            Michael Vincent @Vitaliy Dovgan
            last edited by

            @Vitaliy-Dovgan

            Maybe not possible, maybe an enhancement if not - can I get the return “value” of an NppExec script? I see I can get the exit status:

            $(LAST_CMD_RESULT)  :  result of the last NppExec's command
                                     (1 - succeeded, 0 - failed, -1 - invalid arg)
            

            It would be incredible if I could run an NppExec script as a “subroutine” for input to another:

            SET LOCAL RESULT = NPP_EXEC my_script
            

            My thought would be to create a getopt-like script similar to:

            ::getopt
            SET LOCAL START = 0
            SET LOCAL END ~ $(ARGC) - 1
            IF $(START)==$(END) GOTO END
            :LOOP
            ECHO $(ARGV[$(START)])
            SET LOCAL START ~ $(START) + 1
            IF $(START)<=$(END) GOTO LOOP
            :END
            

            Instead of ECHO, I could concat the args into a variable and return that - just thinking about uses for the new indirect variable reference expansion.

            Cheers.

            Vitaliy DovganV 1 Reply Last reply Reply Quote 0
            • Vitaliy DovganV Offline
              Vitaliy Dovgan @Michael Vincent
              last edited by

              @Michael-Vincent
              If I understand the idea correctly, the same goal can be achieved by setting a non-local variable within a script. E.g.

              set x = 1
              set s = abc ded
              

              will make these variables available everywhere (inside a script, outside a script, inside other scripts) until unset is called for them.

              Michael VincentM 1 Reply Last reply Reply Quote 2
              • Michael VincentM Offline
                Michael Vincent @Vitaliy Dovgan
                last edited by

                @Vitaliy-Dovgan said in NppExec v0.6.2 has been released!:

                achieved by setting a non-local variable within a script

                I hadn’t considered that but yes, that would do it. NPP_EXEC returns to where it was called acting like a subroutine call and we can use SET (not LOCAL) to store the return value.

                Thanks for that!

                Cheers.

                1 Reply Last reply Reply Quote 1

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors