Remus Sarnus
Remus Sarnus

Reputation: 35

Use "Encoding > Convert to ..." as a macro in Notepad++

I tried to record the action of Encoding > Convert to ANSI and save it as a macro so that I can copy and add the its code to another macro. This is the recorded code:

<Macro name="convert to ANSI" Ctrl="no" Alt="no" Shift="no" Key="0">
    <Action type="0" message="2004" wParam="0" lParam="0" sParam="" />
    <Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
    <Action type="0" message="2025" wParam="0" lParam="0" sParam="" />
    <Action type="0" message="2422" wParam="0" lParam="0" sParam="" />
    <Action type="0" message="2325" wParam="0" lParam="0" sParam="" />
</Macro>

If I run it in a file, the output is the code itself (or a few lines from another macro saved in shortcuts.xml), just overwrites the original contents of the file.
Anybody knows how to fix it?

Upvotes: 0

Views: 2505

Answers (1)

Lars Fischer
Lars Fischer

Reputation: 10149

If you are comfortable using the NppExec plugin available from the PluginManager, then you could use this simple NppExec Script:

 NPP_MENUCOMMAND Encoding/Convert to ANSI

Just use Plugins -> NppExec -> Execute... , enter the script, either hit OK or save it for later reuse. (The script is saved in the file npes_saved.txt . You find this file in the plugins\Config subdirectory either in your users Notepad++ path or in the installation directory of Notepad++).

Create a keyboard shortcut for the script

  1. You can save the script with the Save... button in the dialog: Execute Dialog with Save... Button.
  2. Once the script has a name, you can go to the Plugins -> NppExec -> Advanced Options Dialog and associate the script name with an Item name and add the Item name to the menu, see the lower left part in this picture. Advanced Options Dialog.
  3. Restart Notepad++
  4. Now you find the Item name in the Settings -> Shortcut Mapper... Dialog somewhere on the plugins panel. Here you can connect the script with a keyboard shortcut for easy access.

Upvotes: 1

Related Questions