設為首頁收藏本站

艾歐踢論壇

 找回密碼
 立即註冊

QQ登錄

只需一步,快速開始

搜索
熱搜: 活動 交友 discuz
查看: 675|回復: 0
打印 上一主題 下一主題

Python Script for Notepad++

[複製鏈接]
跳轉到指定樓層
樓主
發表於 2017-11-11 11:49:27 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
Installation is very simple, either through Plugin Manager, or manually.
The zip or 7zip archive contains the the files in the correct layout - just copy to your Notepad++ directory (e.g. c:/Program Files/Notepad++)
The file layout is as follows:
Notepad++            (your main Notepad++ directory, probably under "C:\Program Files")
+ |-- python26.dll     (this is important. This needs to go in the main program directory of Notepad++, next to notepad++.exe)
   |                    (unless you have a Python installation already, in which case it's probably in C:\windows already)
+-- plugins
           \
           |-- PythonScript.dll
           |           |-- PythonScript
           |   \
           |   |-- lib
           |   |    \
           |   |     |-- (*.py)   lots of *.py files and subdirectories
           |   |
           |   |-- scripts
           |             \
           |             |-- (machine-level scripts)
           |           |
           |-- doc
           |    \
           |     |-- PythonScript
           |             \
           |             |-- PythonScript.chm         (optional, if it's not there context-sensitive help will use the web)
           |           |
           |           |
           |           |-- Config     (this config directory can also be in %APPDATA%\Notepad++\plugins\config\)
                         |
                         \-- PythonScript
                                         \
                                         |-- scripts
                                                   \
                                                  |-- (user level scripts go here)


Usage
To use Python Script, you’ll first need to create a script. Click New Script from the Python Script menu in the Plugins menu. This creates a new user script (in your config directory). When you’ve typed your script out, you can run it from the Scripts submenu.
The `Scripts` submenu is automatically updated whenever you save a script, so if you copy a file into the scripts directory manually, you’ll need to make a change (a dummy new line or comment etc) and save a script (any will do) in Notepad++ for it to update.
To edit the script, just hold Ctrl down and click the script in the Scripts menu.
If you click Configuration, you can assign the script either to a toolbar icon, or to the Python Script menu itself. If you assign a script to the menu, then it will appear immediately, but you will not be able to assign a shortcut to it until next time Notepad++ starts.
If you assign it to a toolbar icon, then it will only appear on the next start of Notepad++.
Context-Sensitive help is available - if your cursor is on and notepad, editor or console function, the Context-Help menu will take you straight to the documentation for that function. If the CHM file is not in the relevant location, it will open the documentation from the web.

Startup
The script called startup.py (in either the “machine” directory or “user” directory - see Installation) is run when Python Script starts up. Normally, that is the first time a script is called. The default startup.py script does some small things like directing the error output to the console, and importing some commonly used modules.
If you want to register an callback (see Handling Notifications) to run from when Notepad++ starts up, you need to change the startup type to ATSTARTUP, instead of LAZY. You can do this in the Configuration dialog.



分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 轉播轉播 分享分享 分享淘帖
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

小黑屋|Archiver|手機版|艾歐踢創新工坊    

GMT+8, 2024-6-12 01:24 , Processed in 0.232155 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表