• Login
Community
  • Login

Macro woes

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
macro
3 Posts 2 Posters 224 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.
  • T
    Tim Koeleman
    last edited by Aug 25, 2020, 2:34 PM

    After recording a macro to replace several lines of text, I noticed on playing it back some replacements had been made and some had skipped and were unchanged. To isolate the problem, I manually created a new macro containing only the step that was skipped in the larger macro. Still no go. Only running the macro a second time made it work, or doubling the lines in the same macro.

    This is the set of actions that show this behaviour;

    <Action type=“0” message=“2178” wParam=“0” lParam=“0” sParam=“” />
    <Action type=“2” message=“0” wParam=“42002” lParam=“0” sParam=“” />
    <Action type=“3” message=“1700” wParam=“0” lParam=“0” sParam=“” />
    <Action type=“3” message=“1601” wParam=“0” lParam=“0” sParam=‘loadplugin(“\192.168.254.10\core\avisynth\plugins\ffms2.dll”)’ />
    <Action type=“3” message=“1625” wParam=“0” lParam=“0” sParam=“” />
    <Action type=“3” message=“1602” wParam=“0” lParam=“0” sParam=‘Import(“\phobos\c$\core\engine\avisynth\plugins_library\ffindex\v_2_23_1\loader.avs”)’ />
    <Action type=“3” message=“1702” wParam=“0” lParam=“768” sParam=“” />
    <Action type=“3” message=“1701” wParam=“0” lParam=“1608” sParam=“” />

    As said, only when I invoke this one 2 times it will work. No clue what may cause this. Is there anyone that can shed some light on this problem? (Using latest version)

    Thanks

    Tim

    P 1 Reply Last reply Aug 25, 2020, 3:24 PM Reply Quote 0
    • P
      PeterJones @Tim Koeleman
      last edited by PeterJones Aug 25, 2020, 3:24 PM Aug 25, 2020, 3:24 PM

      @Tim-Koeleman said in Macro woes:

      Is there anyone that can shed some light on this problem?

      The macro is behaving exactly like the Replace dialog.
      2d62b002-09f0-4e62-aaf6-ed0a8b373350-image.png
      If I start with my cursor on line 1, if I hit Replace, it has nothing actively matched, so then moves forward and highlights the first instance of the text (line2) without replacing anything. Subsequent Replace clicks will actually do the replacements and move to the next match.

      My modus operendi in search-and-replace is to use Find Next to highlight the first instance, then Replace thereafter. In a recorded macro, that would have one time through the main setup with message="1701" set to lparam='1' for Find Next, and the next time through it would be 1608 for Replace.

      References:

      • https://npp-user-manual.org/docs/config-files/#macros => official docs, describes the action type#'s
      • https://npp-user-manual.org/docs/searching/#searching-actions-when-recorded-as-macros => official docs, describes the search-and-replace (type=“3”) sequences in detail
      T 1 Reply Last reply Aug 25, 2020, 3:37 PM Reply Quote 1
      • T
        Tim Koeleman @PeterJones
        last edited by Aug 25, 2020, 3:37 PM

        @PeterJones thanks a lot! That explains it.

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