最初:
- [プラグイン]ドロップダウンメニューに移動します。  
 
- を開きます
Plugins Manager。   
PythonScriptNotepad ++用にダウンロードします。   
- プロンプトで、Notepad ++を再起動します。
 
次:
- ドロップダウンメニューの[プラグイン]に移動します。  
 
- をクリックし
PythonScript -> new scriptます。 
- スクリプトに
.py拡張子を付けて保存します。 
このコードをコピーして貼り付け、編集します。
#***   IMPORTS   ***
from Npp import *
#*** DEFINITIONS ***
#*** http://docs.python.org/release/1.4/tut/node70.html (.h triple-string variables)***
initial_string="""
  THIS IS A HUGE
  STRING
  WITH COMMENTS
  AND FUNCTIONS
  AND
    NESTING varr
    MISSPELLEDD WORDS
    VARIABLES Varr
  ALL KINDS OF CRAZY STUFF""" 
#***  I am using a case-sensitive replacement;     ***
#***  therefore, I use two replacement operations  ***
#***  First replacement, lowercase ***
print initial_string
user_replacement_string=notepad.prompt(notepad, 'Replace', "")
#*** Second replacement, uppercase ***
editor.replace("varr", user_replacement_string) 
user_replacement_string=notepad.prompt(notepad, 'Replace', "")
editor.replace("Varr", user_replacement_string)
保存します。
次に、新しいファイルctrl-nを作成して、スクリプトをテストします。に進みPlugins->PythonScript->Run Last Scriptます。動作する場合は、作業中のファイルで実行することができます。
便宜上、コマンドのctrl-shift-eショートカットキーを作成しましたRun Previous Script (#yourscriptname.py)。プルダウンメニューで、[設定の->ショートカットマッパー ]に移動します。Plugin commandsタブをクリックします。終わり近く、Run Previous Script。とても便利な。
興味深いことに、このスクリプトを使用して、さまざまなパターンに自分自身を複製できます。私はそれを可能にする方法を本当に知りたいです。私の質問の編集をご覧ください。
重要な編集
以下のコードは、Notepad ++が独自のスクリプトを作成できるようにします。このスクリプトを実行し、c:/program files/Notepad++/plugins/config/PythonScript/scriptsディレクトリ{ Windows default }にファイルを保存します。
#imports
from Npp import *
#variables
pattern_string=notepad.prompt(notepad, 'Pattern String')
number_of_replacements=int(notepad.prompt(notepad, 'Number of Replacements'))
variable_to_replace = []
replacement_title = []
the_header = """#imports
from Npp import *
#definitions
"""
a = "pattern_string = """ + '"' + '""' + pattern_string + '""' + '"'
b = """
print pattern_string
user_replacement_string"""
c = """=notepad.prompt(notepad, 'Replace', "Replaces: """
d = '"' + """)
editor.replace(""" + '"'
e = """", user_replacement_string"""
f = ")"
#function
for i in range (0, number_of_replacements):
    replacement_title.append(str("Replacement Item ") + str(i+1))
    variable_to_replace.append(notepad.prompt(notepad, replacement_title))
print the_header + a
print b + str(i) + c + variable_to_replace[i] + d + variable_to_replace[i] + e + str(i) + f
#thanks Wolfpack08.
頻繁に置き換える必要のある変数とともに、ファイルに頻繁に貼り付ける文字列をインポートできるようにします。変数を使用して入力パターンを記述します(つまり、
This is my stupid input pattern foo, and I use the common variable bar。
スクリプトを実行するとき、最初のポップアップでその入力パターンを指定します。次に、入力パターンの変数の数を指定します:fooとbar(たとえば、「2」変数)。結果のポップアップ入力ボックスで、変数を置換する順序で指定します:( " foo "、 " bar ")。
lexis内で本当にランダムであるとしか想像できないものを置き換えるのは面倒だと思ったので、「デフォルト値」関数を入れませんでした。しかし、多くのデータ入力を行い、この種のマクロを必要とする人々のためにデフォルト値を持つことは非常に役立つと思います。誰かがリクエストをした場合、私はそれを追加します。