• Notepad WYSING

    18
    0 Votes
    18 Posts
    1k Views
    Lycan ThropeL

    @Admin-TKRUO ,
    Wow, this is totally unintelligible. You need to use a better translator, I think.

  • Documentation History

    4
    0 Votes
    4 Posts
    378 Views
    Mark OlsonM

    I felt like my previous script was suboptimal as a keylogger because:

    it could only be parsed by regular expressions it generated a pretty verbose log with every keystroke, which seemed like an easy way to rapidly create a multi-megabyte log file.

    I’ve updated the keylogger so that:

    the log file is a JSON Lines document, which is very easy to parse (just split it into lines and use your favorite JSON parser to parse each line) the date is only logged when the date changes or when the logger first starts up The current filename is only logged when the file is saved or opened. key logs have the format {"+": <text added>, "t": hours:minutes:seconds, "pos": position}, with "-": <text removed> for text removal operations.

    While the user must later re-associate filenames and dates with each modification log, this is a very simple task.

    Below is an example log:

    {"date":"2023-06-07"} {"fileOpened":"Path\\To\\AppData\\Roaming\\Notepad++\\plugins\\config\\PythonScript\\scripts\\keylogger.py","t":"14:38:16"} {"fileOpened":"Path\\To\\Python311\\example_silly.txt","t":"14:38:16"} {"+":"a","pos":0,"t":"14:38:18"} {"+":"s","pos":1,"t":"14:38:18"} {"+":"d","pos":2,"t":"14:38:18"} {"+":"f","pos":3,"t":"14:38:18"} {"+":"\r\n","pos":4,"t":"14:38:19"} {"-":"asdf\r\n","pos":0,"t":"14:38:20"} {"fileSaved":"Path\\To\\Python311\\example_silly.txt","t":"14:38:21"}

    And here’s the new script:

    from Npp import * from datetime import datetime import json from pathlib import Path # create a subdirectory of the PythonScript scripts directory called mod_logger LOGDIR = Path(__file__).parent / 'mod_logger' LOGFILE = LOGDIR / 'mod.jsonl' # create a JSON Lines document in that directory def compact_json_dump(obj): return json.dumps(obj, separators=(',', ':')) def date_to_int(date): return (date.year << 16) | (date.month << 8) | date.day class ModLogger: def __init__(self): self.FNAME = notepad.getCurrentFilename() self.date_int = 0 self.log_date_change() def log(self, obj): with LOGFILE.open('a') as f: f.write(compact_json_dump(obj)) f.write('\n') def log_date_change(self): now = datetime.now() dint = date_to_int(now) if dint > self.date_int: self.date_int = dint self.log({'date': '%d-%02d-%02d' % (now.year, now.month, now.day)}) return now def on_bufferactivate(self, notif): self.FNAME = notepad.getCurrentFilename() now = self.log_date_change() self.log({'fileOpened': self.FNAME, 't': '%02d:%02d:%02d' % (now.hour, now.minute, now.second)}) def on_filesaved(self, notif): now = self.log_date_change() self.log({'fileSaved': self.FNAME, 't': '%02d:%02d:%02d' % (now.hour, now.minute, now.second)}) def on_modification(self, notif): # see https://www.scintilla.org/ScintillaDoc.html#SCN_MODIFIED mod_type = notif['modificationType'] keylog = {} if mod_type & 0x01 != 0: keylog['+'] = notif['text'] elif mod_type & 0x02 != 0: keylog['-'] = notif['text'] else: return keylog['pos'] = notif['position'] now = self.log_date_change() keylog['t'] = '%02d:%02d:%02d' % (now.hour, now.minute, now.second) self.log(keylog) if __name__ == '__main__': try: MOLO except NameError: MOLO = ModLogger() if not LOGDIR.exists(): LOGDIR.mkdir() if not LOGFILE.exists(): with LOGFILE.open('w') as f: pass # I *WANT* to use SCINTILLANOTIFICATION.KEY, which would *actually* # log keypresses, # but for some reason that notification never fires, # and SCINTILLANOTIFICATION.MODIFIED is the closest we've got editor.callback(MOLO.on_modification, [SCINTILLANOTIFICATION.MODIFIED]) notepad.callback(MOLO.on_bufferactivate, [NOTIFICATION.BUFFERACTIVATED]) notepad.callback(MOLO.on_filesaved, [NOTIFICATION.FILEBEFORESAVE])
  • How do i compile CustomizeToolbar plugin?

    3
    0 Votes
    3 Posts
    295 Views
    MiMM

    @Ekopalypse Eh, i just created a new dll project but i didn’t know where to put the customize toolbar source files.

    I thought npp plugin template would give me some insight but i had no luck.
    I’ll give up for now.

  • [Plugin Update] NavigateTo

    22
    0 Votes
    22 Posts
    12k Views
    Mark OlsonM

    @guy038

    Good suggestions! I’ve been enjoying working on this plugin, and I don’t know what Oleksii has in mind, but I’m planning to start working on adding glob syntax to NavigateTo, along with | for logical OR and <expression> for grouping.

    Ideally I’d like to be able to do something like this:
    *foo*.txt | <bar baz.md>
    which would match (.txt files with foo in the filename (but not elsewhere in the path) OR (files named baz.md with bar somewhere else in the path)

    I can also port in the dark mode support that was recently added to the NotepadPlusPlusPluginPack, @sualk.

  • NppExec v0.8.4 has been released!

    1
    3 Votes
    1 Posts
    224 Views
    No one has replied
  • How to setTextColor in DockingDlgInterface Window

    3
    1 Votes
    3 Posts
    249 Views
    Thomas KnoefelT

    Alain, You’re correct, I started testing exclusively in Dark Mode and haven’t gotten to Light Mode yet. Your screenshot is exactly what I was trying to achieve… I have avoided diving into NPP’s code until now, as it might be too time-consuming.

    Thanks for the useful links and info. I’m eager to test them out and see how they help. However, you have a point - maybe it’s best to ignore color issues for now since Dark Mode doesn’t fully support them yet. And colors are not part of the key functionality.

    Also, while implementing, I noticed a couple of bugs related to themes. One is a refreshing problem with comboboxes (not selected lines are pitch black) only in Light Mode (but surprisingly not happening in all Windows installations), and the other is about the color scheme of a disabled list in Dark Mode. I’ll report these on Github.

  • Project plugin functionality

    22
    0 Votes
    22 Posts
    2k Views
    Alan KilbornA

    @General-Coder said in Project plugin functionality:

    but they are pain to read

    Nobody here wants to spoon-feed you. Sorry.

  • Same file in different tabs at different scroll locations

    3
    0 Votes
    3 Posts
    262 Views
    Alan KilbornA

    The “bookmarking” feature may also be of assistance for something like this; see either the Search menu’s Bookmark submenu, or right-click the “sweet spot” for the bookmark margin between the line number and the text editing area:

    c69c29b5-46dd-4194-9b9d-81666a655f43-image.png

    The idea, when you need to jump between 2 (or more) disjointed sections of a file, is that you’d set a bookmark near those sections (with Ctrl+F2) and then jump between them with F2 and Shift+F2.

  • 1 Votes
    6 Posts
    855 Views
    rdipardoR

    @Bas-de-Reuver said in nppPluginList npp-compatible-versions and old-versions-compatibility parameters:

    I was a bit surprised that the latest version of CSV Lint also ran on the oldest Notepad++ v8.2 that I tested, it didn’t crash and worked just fine.

    Not surprising if you consider that N++ doesn’t actually know what lexer functions it’s looking for. It calls them through function pointers, which are nothing but pointers to void. All that any C++ app can do is dereference them and hope there’s a real function at the other end.

    As long as current versions of your plugin export GetLexerCount, GetLexerName and the (now obsolete) GetLexerFactory and GetLexerStatusText, that’s enough to pass in pre-8.4 N++ versions. One of my own plugins was backported all the way to v7.7 by exporting a stub of GetLexerFactory that simply returns 0.

  • WoW Lua Plugin

    7
    0 Votes
    7 Posts
    920 Views
    rdipardoR

    FYI, the real maintainer of LuaWoW just released version 10.0.7: https://github.com/Grogir/LuaWoW/releases

  • PLANTUML viewer plugin error

    6
    0 Votes
    6 Posts
    618 Views
    hagai DanenbergH

    Thank you @PeterJones,
    Based on the link you sent, It looks like there is an issue with the Power Automate setup.
    The problem was solved by deleting Microsoft.Flow.RPA.Desktop.UIAutomation.Java.Bridge.Native from the accessibility.properties file

    Issue resolved!!!
    Thank you very much for the help!

  • Determining if the active document is mono-spaced

    8
    2 Votes
    8 Posts
    452 Views
    CoisesC

    @Mark-Olson said in Determining if the active document is mono-spaced:

    The potential pitfall I see here is weird stuff like BEL and ENQ that are technically ASCII but are represented as big boxes in Notepad++. So you’d probably have to exclude those in your calculation.

    Good point — even if all the fonts in use are fixed pitch, this case (and probably others) could yield an exception. At this point I’m thinking the practical answer will be to get a good guess as to whether the file is “mostly” mono-spaced, and then find a way to identify and adjust for the exceptions as they scroll into view.

    Thanks.

  • HUNSPELL Download

    2
    0 Votes
    2 Posts
    436 Views
    PeterJonesP

    @Ron-Edmonds ,

    I have no problem downloading a Hunspell dictionary.

    Which version of DSpellCheck are you using? I tried with v1.4.24 and it worked, and then saw there was a new version, and updated to v1.5.0, and it still worked.

    Or maybe you are on a computer that needs Proxy Settings – the Connection Settings button in the Download Dictionaries Dialog allows you to set up a proxy.

    If you’re using Windows 7, maybe it doesn’t properly allow https through whatever libraries DSpellCheck is using for the download. In which case, maybe there is an older version that still works with your Notepad++ v8.4.2, but will use an older library for doing the download, which will be compatible with Win 7. (Just a guess. Remember, technically, Notepad++ officially says that Windows 7 “can run” but is not supported. And I don’t know what DSpellCheck policy is on that out-of-support OS.)

  • 1 Votes
    14 Posts
    946 Views
    Mark OlsonM

    @rdipardo
    Cool! I’m going to run with your example and see about writing something that just automatically applies good dark mode styling to all the controls in any arbitrary WinForm rather than having to specify which controls get which colors.

  • Need guidance - Autocompletion plugin

    19
    0 Votes
    19 Posts
    1k Views
    TroshinDVT

    Описание
    I have a project that may interest you jn-npp-scripts. He rudely responds some functionality you mentioned. The main language of this project is Javascript.

    The project was built on the basis of another project ( jn-npp-plugin ).

  • JSTools incompatible with NPP 8.5.x

    2
    0 Votes
    2 Posts
    661 Views
    PeterJonesP

    @swegmike ,

    JSTools 1.2205 x64 installs just fine in a fresh Notepad++ v8.5.2, and is not incompatible.

    There are times when you have done upgrades in the wrong order, or upgrade across too many versions of Notepad++ or a plugin, where it might say it’s incompatible. (Or if you have tried to manually install the 64bit plugin for the 32bit Notepad++, or vice versa.) And sometimes, Plugins Admin is not able to request the correct permissions necessary to uninstall a plugin when it’s gotten itself into that weird state. If you are in that weird situation, then sometimes it is required to manually delete the DLL before you re-install the correct version.

    jstools.dll is incompatible and asking to remove it by selecting “yest”… I must manually delete the dll in the plugins directory for Json.

    What version of JSTool were you using before you tried to uninstall the incompatible one? Because the JSTool plugin, as seen at its home at https://github.com/sunjw/jstoolnpp, uses the DLL known as Plugins\JSMinNpp\JSMinNpp.dll. Please note it is not JSTools.dll, and it is not a Json directory. (Being precise when you ask questions will help you get more meaningful answers.)

  • How to get breakpoint list ?

    23
    0 Votes
    23 Posts
    5k Views
    PeterJonesP

    @PeterJones,

    (I’m also really surprised that Michael’s code worked for him a few years ago; I don’t believe the definition of the MASK field of SCI_MARKERNEXT has changed in the last three years.)

    Nevermind. The definition of Notepad++'s MARK_BOOKMARK has changed in the last three years. Specifically, in v8.4.6 in Sept 2022, it was changed from 24 to 20 to work with Scintilla 5.3.0.

    So just changing that single line to

    SET LOCAL MASK ~ 1<<20

    would have been sufficient.

    In case you don’t understand: 3 years ago, when Michael wrote the script, bookmarks used mark#24, so SET LOCAL MASK ~ 1<<24 set the mask to 0x1000000, so if bit #24 matched, it would say the line number.

    With v8.4.6 and newer, that marker is in bit #20, so if you only are looking at bit#24, it’s not going to find it. Your code, with 0xFFFFFF on the other hand, was looking at all marker numbers from 0 to 23, so it would find marker#20 as the bookmark line. But it would also find any of the other markers on those lines, even the ones that aren’t bookmarks – so it would find markers you weren’t looking for. If you file happened to have other marker types – like if you had any hidden lines due to View > Hide Lines or code folding in your active lexer – then it would report false matches.

    Marker Number References Scintilla reserves #25-31 for folding margins Scintilla reserves #21-24 for Change History Notepad++ reserves #16-20 for “internal use” (specifically, 18 & 19 for hidden lines, and 20 for bookmarks, with two more for future use) Notepad++ allows #0-15 for plugins to use, but makes no guarantee that two plugins won’t try to make use of the same marker.
  • 0 Votes
    3 Posts
    580 Views
    Bas de ReuverB

    Wait a minute, I just realised that it is converting a bytebuffer to a string and then back to a byte buffer. It should just convert the content buffer straight to a byte array and work with that.

    I’ve tested it with the code page 936 and 1252 and it seems to work correctly in both cases.

  • Plugin Admin... window positioning

    3
    0 Votes
    3 Posts
    363 Views
    Bas de ReuverB

    @James-McNamee said in Plugin Admin... window positioning:

    The “Plugin Admin…” window position is locked. It cannot be moved to a new screen position.

    Not exactly sure what you mean by this, could you post a screenshot maybe? I can freely move the dialog around the screen with the mouse. On a Windows setup with multiple monitors, it can even be dragged to the different monitors.

    When you open Settings > Preferences or Settings > Style Configurator, do you have the same issue with those dialogs? Or how about the Notepad++ window itself, can you resize and move that?

  • Grammarly Plugin

    5
    -3 Votes
    5 Posts
    5k Views
    CoisesC

    @Manie-Beneke said in Grammarly Plugin:

    @Prahlad-Makwana4145
    Since this discussion, has any new consideration been given to integrating Grammarly into Notepad ++?
    Combining the two platforms would create a valuable tool and be hugely beneficial if provided as an integrated mobile cloud service.

    A quick look at Grammarly for developers suggests that Grammarly is based on web technologies. This would be difficult (if possible at all) to connect to Notepad++, which is a C++/WinAPI program. It’s also not open source, and since Notepad++ uses the GNU GPL, integrating it without violating one license or the other might be tricky. None of that is to say it couldn’t be done… but don’t hold your breath. I’d say the chances of someone choosing to tackle this one are very low. It’s not a good fit.