"you cannot make application modal windows in Notepad++" --> This is NOT true. "please correct me and show how" --> I'm not going to show you how with Tcl/Tk, because I don't like and don't use it. The capability can be easily demonstrated with this little UI toolkit that a PythonScript user created: https://community.notepad-plus-plus.org/topic/24389 Suggest you check that out and if you have further questions, post to the community site and someone there will help you out.
This issue was found by a Notepad++ user and was mentioned tangentially in an issue here: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13944#issuecomment-1665094241 Subsequently, a formal N++ dedicated to it was opened here: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13969
The first thing I would do would be to update to the latest 64-bit N++ and PythonScript 2.0.
You could use Tk that comes with a full install of PythonScript. (I never liked Tk) I suppose you could use Windows low-level API for creating/managing windows, but that sounds, well, exhausting. I make do with the "prompt" function; here's an example: https://community.notepad-plus-plus.org/post/28702
No idea. You can always open an issue about it here: https://github.com/bruderstein/PythonScript/issues I use CT without problem, but I always put my script icons to the right end of the toolbar anyway (it is where I want them so I've never tried anything else).
Yea, it's a known issue. You can get better results if you use the CustomizeToolbar plugin and set up the button that way.
Post this question here and you'll get some good responses: https://community.notepad-plus-plus.org/
Try it this way: editor.replace('"duration":300', '"duration":315360000')
In general there is not an absolute way to intercept command invocation via their keyboard shortcuts. However, this posting discusses ways of attempting it: https://community.notepad-plus-plus.org/topic/21158/way-to-disallow-copying-text/
Why not just disable it in the Shortcut Mapper?
I don't think I even really understand the question. Maybe best to post on the Community site with more detail about what you're doing.
I don't think I even really understand the question. Maybe best to post on the Community site with more detail about what you're doing.
I don't think I even really understand the question. Maybe best to post on the Community site with more detail about what you're doing.
There are ways, but if you are just going to "auto confirm" a bunch of boxes, why show them?
It appears there may be a problem with the special casing stuff in Pythonscript...see https://github.com/bruderstein/PythonScript/issues/199
Probably you need to use "raw strings" so that your backslashes aren't consumed by Python's interpretation and not given to the regex engine. So, instead of: editor.rereplace("abc", "def") do: editor.rereplace(r"abc", r"def")
Regarding "English"...for whatever localization you're using, can't you just replace the strings with whatever are appropriate for the language, and have it work?
Not 100% certain, but perhaps MENUCOMMAND.FORMAT_CONV2_AS_UTF_8
You probably have to go to Boost::Regex documentation to find out all the details of the regex syntax used. The $ isn't used by itself here. It is part of ${ 1 } which means the first capture group contents. In my testing of exactly what I provided, [I] becomes <i> so I can't reproduce what you're saying. You can get good N++/Pythonscript regex help by posting here: https://community.notepad-plus-plus.org/
So this is not a Pythonscript question, but search for (?i)\[([a-z])\] and replace with <\l${1}>
For someone researching this, it was revived and fixed for release 4.3.1. See the History notes for more information.
I'm pretty sure you'll get some good help if you post your question on the "Community" site. The spam protection wouldn't let me put the link here. Look on Notepad++'s "question mark" menu for "Community"
Right at the front, just like I said. I tried it with your data set and got the results you expected. editor.rereplace(r"(?s)(^F1 VA \d+ )(?=.*\1)", r"! \1") without the (?s) the . won't match end-of-line characters. With it, it will. That way you can still use the . and don't have to resort to the [\s\S] trick (although that works fine, too). Aside: When you use the .* pattern, you should always first consider using it as .*? so that it matches minimally.
"single line flag"? "Pythonscript wants..." -> it's about what YOU want :-) I think I see what you are saying though. You could have left your original regex alone and just added (?s)to the front of it.
"single line flag"? "Pythonscript wants..." -> it's about what YOU want :-) I think I see what you are saying though. You could have left your original regex alone and just added (?-s)to the front of it.
Well, why not just use straight Python without Notepad++ to do manipulation on these files? That would fit better in a "batch" situation like you describe. Or would the Pythonscripts use the power of Notepad++ to do something to the text that it would be difficult to duplicate in straight Python?
I don't think it is reasonably possible, but let me ask you WHY this is important to you? I'm an extensive Pythonscript user and have never wanted/needed to do that.
I don't know, I don't use DSpellCheck. Maybe remove it if you don't use it either. Also, maybe it is an older version, try looking for newer version.
I think your original script would have worked (or been close to working) if you had done: now = datetime.datetime.now() Perhaps why it didn't appear to do anything is you didn't have the console showing to see the errors.
https://notepad-plus-plus.org/community/topic/17256/guide-how-to-install-the-pythonscript-plugin-on-notepad-7-6-3-7-6-4-and-above
There's advice in these places: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5394 https://notepad-plus-plus.org/community/topic/17256/guide-how-to-install-the-pythonscript-plugin-on-notepad-7-6-3-7-6-4-and-above https://notepad-plus-plus.org/community/topic/16942/pythonscript-any-ready-pyscript-to-replace-one-huge-set-of-regex-phrases-with-others/11
Here's an example: editor.setSelection(0,0) editor.addSelection(5,6) editor.addSelection(10,15)
Have a look at the "threading" library Timer object.
Since you know about the "community" it might be best to take your question there.
The way plugins are handled has changed between 7.5.x and 7.6.x. Suggest you look here for more information: https://notepad-plus-plus.org/community/
Okay, but what is a real use for it at all?
For that script (of which I am the author), exactly the way it is provided as a sample, there is no good way to 'stop' it. It could be rearchitected a bit such that it is easily 'stoppable'. Of course, simply restarting Notepad++ and then not running that script again effectively stops it. If you are truly interested in dynamic start/stop of it, I could look into what code changes that would entail; let me know if interested.
Hello Andre, I think Claudia has stopped using Notepad++ and thus no longer monitors the forum. Dave is fairly quiet as well. To respond to your question, what do you mean it "will not work"? What doesn't work about it? What newer version of Notepad++ and Pythonscript have youtried?
So like if you create a new script and put only this in it and try to run it you see nothing in the console?: console.write('hello\n')
I tried posting some code here but it won't let me. This forum is kinda dead anyway. Why don't you repost your question here?: https://notepad-plus-plus.org/community
Can you post a few lines of "before" and "after"? I tried your Find regex in N++, and it just did "odd things" to some text I created, so I think I must have a misunderstanding somewhere about what you are trying to achieve.
I think you're in the wrong place to ask this question.
That is odd; I've looked at that example before but didn't notice "number" in it. I would presume this would be a better way of writing it: return 'Y' + str(int(m.group(1)) + 1) The key point is that what you get out of the regex routines is a string, to add 1 to it you have to convert it to a number, and then to concatenate it to as string, it needs to be made back into a string.
FWIW, it works correctly for me from a .py file...
Always think of the non-script solution first because it is probably easier! :-)
Search on this regular expression: ((\d+)\).+\R).+(\R) and Replace with this: \1Unused \2\3\3 If this isn't what you want then you are expressing your need poorly?
From the description I don't know that I understand what you are trying to do, but is it perhaps something that a regular expression replace operation could do more easily than a Pythonscript?
Hmmm...for the 'already running' question, I use: try/except NameError. Some things to think about, at least...
So okay the set/getProperty technique could be useful for any document-specific need, but I'd be inclined to just do something like this for that kind of need: b[notepad.getCurrentFilename()] = 7 where again "b" is a dict in the global space
Ah, now I see what the 42 meant; I simply thought it was the answer to "everything". Seriously, though, what I do, and maybe it is wrong, but it works, is: script test1.py: a=3 script test2.py: print 'a:', a run test1.py run test2.py console shows: a: 3 After running test1.py, "a" is in the global namespace, to be read out or updated by test2.py. So...why do I need the globals() technique or the set/getProperty technique?
What do you mean by "42"?
I forgot my "match_found" function from the previous post: def match_found(m): print m.span(0)
Backward regular expression searches are problematic. The Notepad++ user interface prohibits them directly (when you change "Search Mode" to "Regular Expression", the "up" direction is cleared and disabled). Perhaps that is why this code produces output: editor.research('a', match_found, 0, 0, editor.getTextLength()) but this does not: editor.research('a', match_found, 0, editor.getTextLength(), 0) (assumes 'a' is in your document)
Backward regular expression searches are problematic. The Notepad++ user interface prohibits them directly (when you change "Search Mode" to "Regular Expression", the "up" direction is cleared and disabled). Perhaps that is why one this code produces output: editor.research('a', match_found, 0, 0, editor.getTextLength()) but this does not: editor.research('a', match_found, 0, editor.getTextLength(), 0) (assumes 'a' is in your document)
Backward regular expression searches are problematic. The Notepad++ user interface prohibits them directly (when you change "Search Mode" to "Regular Expression", the "up" direction is cleared and disabled). Perhaps that is why one branch of this code produces output: editor.research('a', match_found, 0, 0, editor.getTextLength()) but this does not: editor.research('a', match_found, 0, editor.getTextLength(), 0) (assumes 'a' is in your document)
Backward regular expression searches are problematic. The Notepad++ user interface prohibits them directly (when you change "Search Mode" to "Regular Expression", the "up" direction is cleared and disabled). Perhaps that is why one branch of this code produces output: editor.research('a', match_found, 0, 0, editor.getTextLength()) but this does not: editor.research('a', match_found, 0, editor.getTextLength(), 0) (assumes 'a' is in your document)
You could change to a regular-expression replacemement, and add a word-boundary assertion before and after your search term: editor.rereplace(r'\b' + s[0] + r'\b', s[1])
When you use \ inside of a string you need to double it. Example: os.chdir('Y:\\dataFiles')
When you use \ inside of a string you need to double it. Example: os.chdir('Y:\\dataFiles')
When you use \ inside of a string you need to double it. Example: os.chdir('Y:\dataFiles')
Nice work. There are some interesting ideas here. One "problem" I noticed, that makes complete sense in the framework of how Pythonscript works: If you leave the Tk window open and switch back to Notepad++ to continue editing, then you do something which invokes another Pythonscript, this action is disallowed because another Pythonscript (yours) is already running. Not sure how/if this can be worked around, but it is completely natural to want to leave a Tk window open (like a modeless dialog) while...
An alternative solution to the problem of Window clipboard access from Notepad++'s...
So you have a Pythonscript program that you want to install on another computer without...
This appears to be a dead thread but I am now trying to get the win32clipboard technique...
I'm not sure if it is different if you have the installed version of Notepad++ versus...
I think you are likely correct. A search of the NPP source code yields that ALL_OPEN_FILES...
You are pretty much in the right place (the right site) for reporting it. I don't...
I guess at some point the API designer has to decide when to stop. Perhaps this is...
I'm noticing the following behavior with NPP 6.8.3 and PS 1.08: given NL = number...
Leo, I believe that if you want to use the maxCount argument of .rereplace(), you...
DaveW, I guess I have egg all over my face. I tried my stuff with the latest version...
DaveW, I guess I have egg all over my face. I tried my stuff with the latest version...
DaveW, Thanks for taking the time to reply. 99% of me wants to withdraw the original...
I have a pythonscript that can run a really long time (depending upon amount of data...
Hello Bruno, I don't see the script as being attached; maybe it is just me?
This appears to be a bug. However, I noticed that the rereplace function performs...
This appears to be a bug. However, I noticed that the rereplace function performs...
I'm definitely new to this Scintilla thing, but I'm wondering if someone knowledgeable...
Nice! I don't know if I'll use it directly, but I learned some techniques from it...
Jacob, I think you're missing the point. The "problem" is not in a main script, but...
Say I create a new pythonscript file, a.py: from Npp import * from b import * console.write("I'm...
Depending upon script complexity, I like to have debug info go to the console window...
Wow. Super-simple once how things work is known! Thanks, Dave. I ended up still doing...
I think I found a bug with editor.paste() myself, so I'm going to switch to the above...
This seems to be a valid porting from the old pysearch() to the new research(): matches...
Note that I am NOT looking for a listing of NPP's default shortcut/key mapping!!...
How can I get a list of all the current shortcut/key mappings into a text file?
How can I get a textual list of all keyboard shortcuts? This seems like such a basic...