• Login
Community
  • Login

Macro not working

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 3 Posters 4.6k 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
    John McCarthy
    last edited by John McCarthy Nov 25, 2017, 5:45 AM Nov 25, 2017, 5:44 AM

    I recorded a macro and assigned it to a key combo. Then when I run it nothing happens. Here’s the macro:

        <Macro name="mymacro" Ctrl="no" Alt="yes" Shift="no" Key="9">
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="." />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=". " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="." />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="." />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=" ," />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="," />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="," />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=", " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=",  " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=", " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="(" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=" (" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="  (" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=" (" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=" )" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=")" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=")  " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=") " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=") ." />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=")." />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=") ," />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=")," />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="(i " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="(I " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="(im " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="(I&apos;m " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=". . ." />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="..." />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="&#x00B4;" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="&apos;" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=".   " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=". " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="  " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam=" " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam=") , " />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="), " />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="ad/dc" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="ac/dc" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="kjer" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="KJER" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="silver" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="Silver" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="ABCD" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="ABC-D" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="abc d" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="ABC-D" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1601" wParam="0" lParam="0" sParam="qUOP" />
            <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
            <Action type="3" message="1602" wParam="0" lParam="0" sParam="QUOPl" />
            <Action type="3" message="1702" wParam="0" lParam="770" sParam="" />
            <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
            <Action type="0" message="2013" wParam="0" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="42007" lParam="0" sParam="" />
            <Action type="0" message="2178" wParam="0" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="42002" lParam="0" sParam="" />
        </Macro>
    

    Any tips?

    1 Reply Last reply Reply Quote 0
    • J
      John McCarthy
      last edited by Nov 25, 2017, 6:25 AM

      It seems to be doing only the last two steps (SELECT ALL and COPY). Here is more or less the same macro from UltraEdit, much easier to parse and see what I’m doing:

      Find MatchCase “.”
      Replace All “. "
      Find MatchCase " .”
      Replace All “.”
      Find MatchCase " ,"
      Replace All “,”
      Find MatchCase “,”
      Replace All ", "
      Find MatchCase ", "
      Replace All “, "
      Find MatchCase “(”
      Replace All " (”
      Find MatchCase “)”
      Replace All ") "
      Find MatchCase “) .”
      Replace All "). "
      Find MatchCase "(i "
      Replace All " (I "
      Find MatchCase “. . .”
      Replace All “…”
      Find MatchCase "(im "
      Replace All " (I’m "
      Find MatchCase “´”
      Replace All “'”
      Find ". "
      Replace All ". "
      Find " "
      Replace All " "
      Find ") , "
      Replace All "), "
      Find MatchCase “kkjhgjgh”
      Replace All “JHVJHVHJV”
      SelectAll
      Copy

      1 Reply Last reply Reply Quote 0
      • J
        John McCarthy
        last edited by Nov 25, 2017, 8:23 AM

        With more testing, I find the macro is performing the the find/replaces fine until it gets to a find replace that has a “not found” result, after which it skips to the end and does the final select all and copy. So how do I stop it skipping all the find-replaces after not finding one?

        S 1 Reply Last reply Nov 25, 2017, 1:53 PM Reply Quote 0
        • S
          Scott Sumner @John McCarthy
          last edited by Nov 25, 2017, 1:53 PM

          @John-McCarthy:

          I set up your macro (the one where you posted the code for it), and then ran it on some data where only the last replace operation would succeed. Running it showed that it did the replacement, the select-all, and the copy. Clearly there were a bunch of 0 Occurrences were replaced conditions occurring earlier in the macro, and these did not interfere with the execution path of the macro (that I could tell, anyway).

          J 1 Reply Last reply Nov 25, 2017, 1:58 PM Reply Quote 1
          • J
            John McCarthy @Scott Sumner
            last edited by John McCarthy Nov 25, 2017, 1:58 PM Nov 25, 2017, 1:58 PM

            @Scott-Sumner Try testing it where a few conditions are met early on. Then see if it fixes the later ones … does not for me.

            And on another point, I was looking for the meaning of lparam=“770” and it is not listed in the official documentation:
            http://docs.notepad-plus-plus.org/index.php/Editing_Configuration_Files#Search_.2F_Replace_encoding

            Does nobody keep the site up to date?

            S 1 Reply Last reply Nov 25, 2017, 2:30 PM Reply Quote 0
            • S
              Scott Sumner @John McCarthy
              last edited by Nov 25, 2017, 2:30 PM

              @John-McCarthy

              Try testing it where a few…

              Well, I’m not paid support (but I like to help, if I can), so I can’t poke and prod at your scenario at total random. Why don’t you post some text that illustrates the failure condition you see, along with the exact macro you are running (since I suspect it has changed since the above)?

              lparam=“770”

              Well, this IS in that documentation you pointed to. You just have to know how to interpret it. See the table after Flag values when message = “1702”: Decompose your value of 770 into: 512 + 256 + 2. Then consult the table and see that 512=search-direction(see note below), 256=wrap-around, 2=case-sensitive. So these 3 things affect your search…

              Note: There is a bug in the table where it indicates that 512 means an upward search–it actually means a downward search. However, in your case you have wrap-around set, so the search&replace runs over the whole file, from top to bottom (i.e., upward/downward has no meaning). Just remember if you are hand-editing a macro that doesn’t use wrap, that the search direction setting will be important–and that the table is wrong.

              …nobody keep the site up to date

              I think that is a true statement. :-D

              1 Reply Last reply Reply Quote 0
              • J
                John McCarthy
                last edited by John McCarthy Nov 25, 2017, 2:43 PM Nov 25, 2017, 2:40 PM

                @Scott-Sumner Thanks, I’m going to d/load and re-install notepad++ and test some more. I should have MD5ed the download.

                @Scott-Sumner said:

                Decompose your value of 770 into: 512 + 256 + 2.

                Ha, very user friendly!

                A S 2 Replies Last reply Nov 25, 2017, 2:59 PM Reply Quote 0
                • A
                  Alan Kilborn @John McCarthy
                  last edited by Nov 25, 2017, 2:59 PM

                  @John-McCarthy said:

                  d/load and re-install notepad++
                  I should have MD5ed

                  The sign of the truly desperate dreamer…good luck

                  1 Reply Last reply Reply Quote 0
                  • S
                    Scott Sumner @John McCarthy
                    last edited by Nov 25, 2017, 3:08 PM

                    @John-McCarthy

                    Ha, very user friendly!

                    I don’t think you can complain about that not being user-friendly. Well, you can, but no one will listen: Macros are supposed to be recorded by the macro-recorder. So the encoding only needs to be readable by Notepad++ itself when it plays back the macro. The fact that you can hand-edit macros is a privilege (they could, after all, be recorded in some encrypted binary format that would be next-to-impossible to hack–for expedient useful reasons).

                    So you decided posting some sample text that shows your problem is not worth your time but grasping at the reinstall straw is? :-)

                    1 Reply Last reply Reply Quote 0
                    • J
                      John McCarthy
                      last edited by John McCarthy Nov 25, 2017, 8:47 PM Nov 25, 2017, 8:45 PM

                      Interestingly, after a re-install, it’s working! Hooray!

                      I am rurally located, at the end of a long and old copper line, and I have a seriously flaky connection, so corrupted downloads happen a lot. Many MP3 downloads are totally messed up.

                      Now that this is working, I can look at N++ as a serious contender to replace UE, which was becoming very slow at startup.

                      Thanks to everyone for the help.

                      I don’t think you can complain about that not being user-friendly. Well, you can, but no one will listen

                      All I’m asking is that the documentation explains how it works. Then it becomes ‘user friendly’.

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