Frustrating macro problem

  • james

    james - 2012-07-03

    Hi there,

    Been using notepad plus plus for a while now and I am familiar with the macro tool even before using notepad ++ but when I try to do the following I get an unexpected result.

    I have a huge list like this one:

    HANS 0.015 21,884 557
    MONTE 0.015 21,884 558
    BLAINE 0.015 21,884 559
    ERNIE 0.015 21,884 560
    CURT 0.015 21,884 561

    and would like to delete everything after the first column (names column).

    What I do is copy the space after HANS (" " - that is actually a tab), start recording a macro, place my pointer in front of my first line, press CTRL + F (find function), search for the tab that I already copied, hit search - this will highlight the tab, I will then press SHIFT + END so the already selected tab and the numbers following it until the end of line get highlighted and then press delete or backspace (actually there's no difference here). I press arrow down key to move to the next line and press HOME so I get my cursor in the first position of that second line.

    Makes sense right? Now I test my macro using the "Playback" (the little "play" icon) and works great .. deletes all chars after the name and places the cursor to the next line.


    When I try to use the "Run a Macro Multiple Times" feature .. and run it for 5 times (for example, or untill the end of file) all that my macro does now is to delete the whole lines.

    Any ideeas ? Try not to solve this with a complicated regexp as it doesn't make sense for something as simple as this.

  • Loreia2

    Loreia2 - 2012-07-04


    regex is actually a much simpler solution for your problem.

    Search for: \t.*   (that's TAB, DOT, STAR)
    Replace with nothing

    You approach is OK, but you make a mistake when looking for TABs.
    You need to use Extended search mode, and use \t for TABs (that's backslash and letter t). Other than that, you way should work too.


  • Outspoken2

    Outspoken2 - 2012-10-13

    This is actually  a bug. We should be opening a bug report for this.

  • Fool4UAnyway

    Fool4UAnyway - 2012-10-13

    You don't want a complex regular expression, but the one loreia2 gave, isn't complex at all.
    In my opinion, this is the way to go for such a simple problem, because this is very basic (regex) stuff.

    But, if you insist on using such a complex macro (really, it's complex, look at all those steps), there is a more safe way to be successful than the one you are using.

    After you have selected and deleted anything from the tab up to the end of the line, the cursor will definitely be at the new end of the line, just after the only word that's left now. To be sure to get to the start of the next line, simply press CursorRight.

    Pressing CursorDown will get you to the next line, but pressing Home is no guarantee that you will get to the start. It may depend on any white space that is present before the current column position of the cursor (and on the key or function setting for the Home key/behavior).

    Does this macro also pose a problem if you manually run it a number of single times?
    How does my suggestion perform?

  • Outspoken2

    Outspoken2 - 2012-10-14

    I don't know about the complexity of the macro fro mjohnny776, but I am able to reproduce the same problem with much simpler macros. Example:

    I want to delete the text after #
    I move cursor to start of first line then:

    When I run the above macro one line at  a time by clicking the run button, it works fine. If I select any of the run multiple times options (count or till EOF) I end up with completely empty lines.

    Regex works here. It is a better solution. No one is denying that.
    But I am saying that this bug was introduced in N++ recently, I remember working with simillar macros on N++ before and they worked.

    So: Macro Works when run one line at a time, fails when run multiple times.

  • Gnomen Klayture

    Gnomen Klayture - 2012-11-09

    Outspoken2, you seem to have encountered an error I'm having as well, with the record & play working with a find in the mix.
    Apparently you've used a programmatic fix, I just used it like the help file says to and yep, you guessed it: FAIL!
    My Process is about as simple as you can get:
    Click Red (record) > Ctrl F (find . -a period) > end > ctrl Back-Arrow > insert tab > end … click black for Play
    click Play
    I've gone through the posts in the forums, searching (globally) for several variations of "macro find record play" and it seems (even though the title of your post didn't really hint at the issue, the search did find the substance of my issue, in recent months) that this has been an on-going "wish list" fix since 2007!!!
    Anyone at SourceForge working on this project able to provide either a "FIX or a "Work-Around" or even the PROMISE of fixing the recorder's ability to make use of Ctrl F in the recording of an operation that can be used, via the Play, would be great!!!
    Frankly, if this can't be fixed, I'm going to end up abandoning Notepad++ for something else that can perform such a simple macro of (beginning of procedure) "Find"  (end of procedure)…
    __For that matter, is there anyone still working this project?__
    If so, why, in Five Years, hasn't this been addressed and fixed?

  • Outspoken2

    Outspoken2 - 2012-11-11

    Hi gnomenklayture,
    I am pretty sure that this problem was introduced in a recent release. It did not exist since 2007. Can you try with a 5.x version of N++?

    Would help me too.

  • Gnomen Klayture

    Gnomen Klayture - 2012-11-11

    Hey outspoken2, got your question at the house. Need to ck the history in work browser for exact 2007 reference. I should have mentioned I'm using the portable version, but have tried this in the integrated installs from 4.xx to latest, of  Click/Press -RED- "Record" (beginning of procedure) "Find" (end of procedure) Click/Press -BLACK- button to save the previous 'find' operation, after again doing the Click/Pressing of the -BLACK- (Play) button and NOTHING Happens…. remove the Ctrl-F from the operation and it runs…. I'm trying to use logic here and as always logic in a logic oriented profession fails me. As I said, it's such a simple task, but it won't record and play:
    Click Red (record) >
    Ctrl F (find . -a period) > end >
    ctrl Back-Arrow (back to extensions period) > insert tab > click end, then… click black for Play click Play NOTHING!!!
    Searching forums for issues related to the use of these two menu bar buttons is a Bitch! Obscure results, porn? How does that relate to a 'closed forums' search results? Oh I know, if you use those two menu bar buttons in Notepad++ to 'search/find' "Blow Jobs" and delete them all, the record/play doesn't work, so you just have to live with an obvious failure of, what can only be referred to as a Prominent Tab-bar Macro Record/Play "Feature"… beginning to feel like I'm working with Dell PC/Laptop Support (talk about failure!)
    Just do me a favor would you?
    Try what I just out lined?
    go to a folder, in the cmd window, enter the command DIR/ON/B/S > C:\Files_list.txt
    Then Notepad++ the file, "C:\Files_list.txt"
    perform as I outlined above and see if the FIND works for you, would you?
    Let me know?
    BTW, If I've confused you in any way trying to describe what I'm asking you to do, in order that you can see what's NOT happening, let me know and I'll do my best to make it so that my request can be better understood… VAX/VMS' EVE could record any series of keystrokes and play them back … No Problem… I REALLY miss my VAX/VMS Eve Editor… so much!
    Well, let me know, thanks!

  • Outspoken2

    Outspoken2 - 2012-11-11

    I just tried it is N++ 6.2 and it works. Can we have team viewer and see this on my system.
    P.S.: I am no developer working on N++, just a fellow user.

  • Outspoken2

    Outspoken2 - 2012-11-11

    When I meant it works on 6.2, I meant the simple steps. The complicated ones still don't. i assume there are lots of bugs related to the macros.
    It is very frustrating. Even I have begun searching for a free alternative to NP++

  • Gnomen Klayture

    Gnomen Klayture - 2012-11-11

    did you go the route of doing a find so that F3 would be "pre-loaded" and incorporated that and is yours the integrated install or the portable… sorry, I'm SysAdmin where I work and I just am a tad too … err, uh … Hyper-aware (ok, paranoid) to open my system… there's a couple of apps you can get at source forge that will allow you to record what you do and we could 'see' interactively that way, via capture videos…. but I do understand your frustrations. You get hooked on an app (aka finally got over the 'learning curve') and it won't do what you expect it to…. of course, administrating and "programming" are, like medicine, specialized fields and just because we in computers it is not to be confused with "All Knowing"… I have to wear a T-Shirt "No! I will NOT work on you PC!!!"
    well, let me know… in the mean time, I'm going make sure of the ver of my notepad- oops, ++ :)

  • Bradley C Wise

    Bradley C Wise - 2013-09-05

    This appears to still be a problem as it has been for years. Why hasn't this been fixed? I can create a simple macro and manually run it as many times as I want, but when I try to play it multiple times it gets confused and garbles things up. I can even hold down Control-Shift-P and it will work. What a pain. I do loves me some notepad++, don't get me wrong. But it would be extremely helpful to be able to play multiple times and get the same results and playing a single time.