Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 103231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:05:29+00:00 2026-05-11T01:05:29+00:00

I would like to write a macro for Notepad++ which should replace char1, char2,

  • 0

I would like to write a macro for Notepad++ which should replace char1, char2, char3 with char4, char5, char6, respectively.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:05:29+00:00Added an answer on May 11, 2026 at 1:05 am

    Macros in Notepad++ are just a bunch of encoded operations: you start recording, operate on the buffer, perhaps activating menus, stop recording then play the macro.
    After investigation, I found out they are saved in the file shortcuts.xml in the Macros section. For example, I have there:

    <Macro name='Trim Trailing and save' Ctrl='no' Alt='yes' Shift='yes' Key='83'>     <Action type='1' message='2170' wParam='0' lParam='0' sParam=' ' />     <Action type='1' message='2170' wParam='0' lParam='0' sParam=' ' />     <Action type='1' message='2170' wParam='0' lParam='0' sParam=' ' />     <Action type='0' message='2327' wParam='0' lParam='0' sParam='' />     <Action type='0' message='2327' wParam='0' lParam='0' sParam='' />     <Action type='2' message='0' wParam='42024' lParam='0' sParam='' />     <Action type='2' message='0' wParam='41006' lParam='0' sParam='' /> </Macro> 

    I haven’t looked at the source, but from the look, I would say we have messages sent to Scintilla (the editing component, perhaps type 0 and 1), and to Notepad++ itself (probably activating menu items).
    I don’t think it will record actions in dialogs (like search/replace).

    Looking at Scintilla.iface file, we can see that 2170 is the code of ReplaceSel (ie. insert string is nothing is selected), 2327 is Tab command, and Resource Hacker (just have it handy…) shows that 42024 is ‘Trim Trailing Space’ menu item and 41006 is ‘Save’.
    I guess action type 0 is for Scintilla commands with numerical params, type 1 is for commands with string parameter, 2 is for Notepad++ commands.

    Problem: Scintilla doesn’t have a ‘Replace all’ command: it is the task of the client to do the iteration, with or without confirmation, etc.
    Another problem: it seems type 1 action is limited to 1 char (I edited manually, when exiting N++ it was truncated).
    I tried some tricks, but I fear such task is beyond the macro capabilities.

    Maybe that’s where SciTE with its Lua scripting ability (or Programmer’s Notepad which seems to be scriptable with Python) has an edge… 🙂

    [EDIT] Looks like I got the above macro from this thread or a similar place… 🙂 I guess the first lines are unnecessary (side effect or recording) but they were good examples of macro code anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 108k
  • Answers 108k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Actually I agree with Andrew Hare's answer, just pass a… May 11, 2026 at 9:10 pm
  • Editorial Team
    Editorial Team added an answer Yes, you are correct. It's possible for two instances of… May 11, 2026 at 9:10 pm
  • Editorial Team
    Editorial Team added an answer The error is almost certainly that your file is not… May 11, 2026 at 9:10 pm

Related Questions

I have a utility (grep) that gives me a list of filenames and a
I have a 'foreach' macro I use frequently in C++ that works for most
Calling all C macro gurus... Is there any way to write a C macro
If I write a #define that performs an operation using other preprocessor constants, is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.