What do you mean by crash? What happened exactly? Did notepad freeze, or
just close, or close with a "Notepad++ has performed an illegal operation"
or some such message?
I'd try disabling other plugins (just move the other DLLs out of you
notepad++\plugins directory - probably C:\Program files
(x86\Notepad++\plugins or c:\Program Files\Notepad++\plugins). I'd also
try with the newest version - you can download and install PythonScript
1.0.8 from the MSI - https://sourceforge.net/projects/npppythonscript/files/Python%20Script%201.0.8.0/
What I meant was Notepad++ crashed completely and had to be restarted. The error message was something like: "plugin tried to terminate in an unusual way."
It's academic now; as recommended, I have downloaded the latest msi installer, which seems to have fixed both problems.
i.e.
2) It no longer crashes.
2) I no longer need to explicitly call Npp.editor.addText, a simple editor.addText works.
By the way, really a separate topic, but is there a way to add scripts to the context menu?
To answer my own question, yes you can have scripts as items in the context menu. There are a couple of similar examples in the contextmenu.xml, (if you read carefully.)
To get them to work for python scripts, you need to configure the scripts as menu items and then modify the following XML to suit:
I want to write a simple set of scripts to insert text strings into a document at the cursor position.
After looking through the help, I tried:
editor.write('hello world')
All this did was crash Notepad++
After searching this forum, I tried:
import Npp
Npp.editor.write('hello world')
This inserted the text, but Notepad++ still crashed.
I am using Notepad++ 6.6.9 along with the most upto date plugin available from the plugin manager. (1.0.6.0)
Irvine
There is no need for "import Npp" in the user script
Try:
You can 'experiment' at the console command prompt!
What do you mean by crash? What happened exactly? Did notepad freeze, or
just close, or close with a "Notepad++ has performed an illegal operation"
or some such message?
I'd try disabling other plugins (just move the other DLLs out of you
notepad++\plugins directory - probably C:\Program files
(x86\Notepad++\plugins or c:\Program Files\Notepad++\plugins). I'd also
try with the newest version - you can download and install PythonScript
1.0.8 from the MSI -
https://sourceforge.net/projects/npppythonscript/files/Python%20Script%201.0.8.0/
Dave.
On Tue, Sep 30, 2014 at 9:33 AM, Kadner kadner@users.sf.net wrote:
Thanks for your prompt reply.
What I meant was Notepad++ crashed completely and had to be restarted. The error message was something like: "plugin tried to terminate in an unusual way."
It's academic now; as recommended, I have downloaded the latest msi installer, which seems to have fixed both problems.
i.e.
2) It no longer crashes.
2) I no longer need to explicitly call Npp.editor.addText, a simple editor.addText works.
By the way, really a separate topic, but is there a way to add scripts to the context menu?
For example adding something like:
<Item MenuEntryName="script" MenuItemName="pattern"/>
to contextmenu.xml
Thanks again
Irvine
To answer my own question, yes you can have scripts as items in the context menu. There are a couple of similar examples in the contextmenu.xml, (if you read carefully.)
To get them to work for python scripts, you need to configure the scripts as menu items and then modify the following XML to suit:
<Item FolderName="Useful strings" PluginEntryName="Python Script" PluginCommandItemName="write_'to-be'"/>
Note: write_'to-be'.py was the name of one of my scripts.
Thanks again for both your help and python scripts
Irvine