• Capturing Scintilla notifications

    3
    0 Votes
    3 Posts
    622 Views
    S

    @dail this is exactly what I was looking for. Thank you so much!

  • PythonScript: Different behavior in script vs in immediate mode

    14
    1 Votes
    14 Posts
    2k Views
    PeterJonesP
    Status Bar Manipulation Allowing Extra Status Bar Section

    Complete example:

    implements a class for StatusBar manipulation includes a method which adds an extra StatusBar section includes an example callback to force it to a particular string
    (this could be changed so the callback puts some piece of particular
    info into the status bar) shows a 10sec example of it being used; note, because Notepad++ resets
    the status bar every time it changes tabs, you can see it flashing
    frequently. After that 10s, the callback will be cleared.

    You can take that concept and get rid of the clear-after-10s, which will mean that the status bar will continue to add that section as needed and display your information.

    Because it’s fighting Notepad++ for control of the status bar, things like toggling to a different tab or different view (or from one of the panels back to an editor tab) will cause Notepad++ to reset the status bar, then the UPDATEUI will trigger the callback to update the statusbar. This may cause unpleasant flashing of the status bar if you are changing tabs or panels frequently.0

    # encoding=utf-8 """StatusBar Manipulation !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! USER WARNING: STATUS BAR MAY FLASH DURING UPDATE !!! !!! FLASH-SENSITIVE USERS SHOULD NOT USE THIS SCRIPT !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Complete example: * implements a class for StatusBar manipulation * includes a method which adds an extra StatusBar section * includes an example callback to force it to a particular string (this could be changed so the callback puts some piece of particular info into the status bar) * shows a 10sec example of it being used; note, because Notepad++ resets the status bar every time it changes tabs, you can see it flashing frequently """ from Npp import * import ctypes from ctypes.wintypes import BOOL, HWND, WPARAM, LPARAM, UINT from struct import pack, unpack from time import sleep class _SB(object): """refer to these values as _SB.xxxx elsewhere""" LRESULT = LPARAM WNDENUMPROC = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM) WM_USER = 0x400 SB_SETPARTS = WM_USER + 4 SB_GETPARTS = WM_USER + 6 SB_SETTEXTA = WM_USER + 1 SB_SETTEXTW = WM_USER + 11 SB_GETTEXTA = WM_USER + 2 SB_GETTEXTW = WM_USER + 13 SB_GETTEXTLENGTHA = WM_USER + 3 SB_GETTEXTLENGTHW = WM_USER + 12 SBT_OWNERDRAW = 0x1000 ctypes.windll.user32.SendMessageW.restype = LRESULT ctypes.windll.user32.SendMessageW.argtypes = [ HWND, UINT, WPARAM, LPARAM ] _SB() # call it to initialize class NppStatusBar(object): """implement a class wrapper around the status bar""" def __init__(self): self._APP = None self._HANDLE = None def EnumCallback(hwnd, lparam): curr_class = ctypes.create_unicode_buffer(256) ctypes.windll.user32.GetClassNameW(hwnd, curr_class, 256) if curr_class.value.lower() == "msctls_statusbar32": self._HANDLE = hwnd #console.write("\t{:32s}0x{:08x}\n".format("sbWnd:", hwnd)) return False return True # console.write("\n" + __file__ + "::" + str(self.__class__) + "\n") self._APP = ctypes.windll.user32.FindWindowW(u"Notepad++", None) # console.write("\t{:32s}0x{:08x}\n".format("Notepad++ hWnd:", self._APP)) ctypes.windll.user32.EnumChildWindows(self._APP, _SB.WNDENUMPROC(EnumCallback), 0) # console.write("\t{:32s}0x{:08x}\n".format("StatusBar hWnd:", self._HANDLE)) self.__debugStatusBarSections() def __debugStatusBarSections(self): for sec in [STATUSBARSECTION.DOCTYPE,STATUSBARSECTION.DOCSIZE,STATUSBARSECTION.CURPOS,STATUSBARSECTION.EOFFORMAT,STATUSBARSECTION.UNICODETYPE,STATUSBARSECTION.TYPINGMODE]: self.getStatusBarText(sec) def getStatusBarText(self, sec): section = int(sec) retcode = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_GETTEXTLENGTHW, section, 0) length = retcode & 0xFFFF sbtype = (retcode>>16) & 0xFFFF assert (sbtype != _SB.SBT_OWNERDRAW) text_buffer = ctypes.create_unicode_buffer(length) retcode = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_GETTEXTW, section, ctypes.addressof(text_buffer)) text = '{}'.format(text_buffer[:length]) del text_buffer # console.write("\tSendMessage(0x{:08x}, 0x{:04x}, {:d}, {:d}) => 0x{:04x} 0x{:04x} \"{:s}\"\n".format(self._HANDLE, _SB.SB_GETTEXTLENGTHW, section, 0, sbtype, length, text)) return text def setStatusBarText(self, sec, txt): section = int(sec) if section <= 5: notepad.setStatusBar(STATUSBARSECTION.values[sec], txt) else: nChars = len(txt) text_buffer = ctypes.create_unicode_buffer(nChars) text_buffer[:nChars] = txt[:nChars] # console.write(repr(text_buffer)) retcode = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_SETTEXTW, section, ctypes.addressof(text_buffer)) del text_buffer # console.write("\t...\n") # sleep(1) # console.write("\t... done\n") def getStatusBarNumberOfSections(self): nParts = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_GETPARTS, 0, 0) return nParts & 0xFFFF def getStatusBarParts(self): nParts = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_GETPARTS, 0, 0) # console.write("getStatusBarParts() -> nParts = {}\n".format(nParts)) nBytes = 4 * nParts buf = ctypes.create_string_buffer(nBytes) retcode = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_GETPARTS, nParts, ctypes.addressof(buf)) #retcode = SendMessage(sb7_StatusBarCallback.STATUSBAR_HANDLE, SB_GETPARTS, nParts, buf) # console.write("\tretcode = {}\n".format(retcode)) ints = unpack('i'*nParts, buf[:nBytes]) # console.write("\tbuf = {:s} = {:s}\n".format(repr(buf[:nBytes]), ints)) del buf return ints def setStatusBarParts(self, *args): # console.write("setStatusBarParts({:s})\n".format(args)) nParts = len(args) nBytes = 4 * nParts buf = ctypes.create_string_buffer(nBytes) buf[:nBytes] = pack('i'*nParts, *args) # console.write("\tedit buf = {:s} = {:s}\n".format(repr(buf[:nBytes]), unpack('i'*nParts, buf[:nBytes]) )) retcode = ctypes.windll.user32.SendMessageW(self._HANDLE, _SB.SB_SETPARTS, nParts, ctypes.addressof(buf)) # console.write("\tretcode = {}\n".format(retcode)) def addStatusBarSection(self, text, width): # console.write("addStatusBarSection({:s})\n".format(text)) oldParts = self.getStatusBarParts() nParts = len(oldParts) subtract = int(width / nParts) scaled = map(lambda x: x-subtract, oldParts) scaled.append( oldParts[-1] ) self.setStatusBarParts( *scaled ) self.setStatusBarText( nParts, text ) def example_setSeventhSection(self, txt, width): """ If there are 7 sections, update text; if less, add a section and """ n = self.getStatusBarNumberOfSections() if n==7: self.setStatusBarText(n-1, txt) else: self.addStatusBarSection(txt, width) if __name__ == '__main__': def example_callback(args): sb.example_setSeventhSection("Example", 360) console.show() sb = NppStatusBar() editor.callback(example_callback, [SCINTILLANOTIFICATION.UPDATEUI]) example_callback(None) # call it once to update the UI manually console.write("For the next 10s, should say Example... \n") console.write("... even if you UpdateUI (change tabs, etc)\n") sleep(10) editor.clearCallbacks(example_callback) console.write("... DONE. The next UpdateUI will clear it.\n")


    edit: added if __name__ == '__main__': and indentation, to make it importable

  • The Plugin Hex converter doesn't appear to be correct?

    8
    0 Votes
    8 Posts
    3k Views
    Alan KilbornA

    @IRI

    I agree with @artie-finkelstein – I’ve never “installed” HxD to use it.

  • Looking for ideas/suggestions

    11
    1 Votes
    11 Posts
    2k Views
    EkopalypseE

    @Vitaliy-Dovgan said in Looking for ideas/suggestions:

    In case of further questions, feel free to contact me.

    Thx, I did.

  • Speech Plugin 64 bit

    4
    2 Votes
    4 Posts
    949 Views
    Ralph Spencer SteenblikR

    It looks like the speech plugin is now working in the latest version.

  • Customize Toolbar - New Version 5.3

    1
    0 Votes
    1 Posts
    713 Views
    No one has replied
  • Customize Toolbar - New Version 5.2

    2
  • [c#] how to set/change current filename/fileextension

    4
    0 Votes
    4 Posts
    539 Views
    MarioRosiM

    Hello Ekopalypse and PeterJones,

    thanks for your suggestions. Now i create a new tab and copy the new format into that tab.
    Then can decide the user how to save the file.

    regards Mario

  • NppExec v0.7 has been released!

    2
    3 Votes
    2 Posts
    617 Views
    Vitaliy DovganV

    An early access build of the next version of NppExec is available!
    It fixes a few things in v0.7 and contains the following changes:

    changed: now IF/IF~/ELSE IF use delayed $(var) substitution.
    It means that IF “$(var)” != “” will work even when the value of $(var)
    contains inner " quote character(s). added: now npe_debuglog supports the keyword “local”. changed: $(var) substitution has been reworked and improved added: set <var> ~ strexpand <s>

    Get it here, NppExec20210804_dll:
    https://sourceforge.net/projects/npp-plugins/files/NppExec/NppExec Plugin (dev)/

    Please let me know if there are any issues.

  • Bug: Style Token not working on selected substring

    2
    0 Votes
    2 Posts
    652 Views
    EkopalypseE

    @Louis-Jordan

    There are now settings for this…

    e63e852d-4e75-4b6a-b9e5-1faf38e70613-image.png

  • NPPFTP with NPP v8.1.2

    4
    0 Votes
    4 Posts
    709 Views
    Dominique CharbonnelD

    Hello,

    I’ve find the cause : the proxy of my job.

    Thanks for your help.

  • 1 Votes
    3 Posts
    458 Views
    KnIfERK

    Opened a bug report for you on the github

    :)

  • Update the MultiClipboard plugin to support NPP's new darkmode!

    1
    2 Votes
    1 Posts
    535 Views
    No one has replied
  • Found Indecent Phrase during Installation

    4
    -1 Votes
    4 Posts
    641 Views
    PeterJonesP

    @Alan-Kilborn said in Found Indecent Phrase during Installation:

    I seem to recall this has been pointed out before; not sure if it was in a community posting here, or someone actually made a github issue out of it.

    There was a recent post here, and it actually linked to times when the phrase was removed then re-installed. According to the comments in those commit messages, there were complaints whichever direction he changed the quotes.

  • 6 Votes
    1 Posts
    605 Views
    No one has replied
  • Compare plugin icons are not visible in fluent UI

    3
    0 Votes
    3 Posts
    743 Views
    dave-userD

    Please see my post regarding the release of Customize Toolbar 5.1.

    Using the custom button definition feature and quick codes, it is very easy to create images for the Compare plugin buttons that are not visible when using Fluent Icons.

    dave-user

  • Customize Toolbar - New Version 5.1

    1
    4 Votes
    1 Posts
    800 Views
    No one has replied
  • LanguageTool Plugin

    5
    0 Votes
    5 Posts
    1k Views
    artie-finkelsteinA

    @AZJIO-AZJIO
    It’s suggestions like this that begin to raise my interest in your postings. I suggest you consider posting translations of the key portion of your help (.chm) files. The Readme_Ru.txt files you create are more commonly known as a changes_ru.txt file and do not tell me much about what the program can do. I don’t think too many users will de-compile and then Google translate an entire .chm file to locate the key information to then determine if they are interested in learning to use the plugin. My guess is that you write better English than 99% of the users on the Community board can write Russian.

    using Google translate:
    Подобные предложения начинают повышать мой интерес к вашим сообщениям. Я предлагаю вам рассмотреть возможность публикации переводов ключевой части ваших файлов справки (.chm). Создаваемые вами файлы Readme_Ru.txt более известны как файл changes_ru.txt и мало что говорят мне о возможностях программы. Я не думаю, что слишком много пользователей будут декомпилировать, а затем Google переведет весь файл .chm, чтобы найти ключевую информацию, чтобы затем определить, заинтересованы ли они в обучении использованию плагина. Я предполагаю, что вы пишете по-английски лучше, чем 99% пользователей форума сообщества могут писать по-русски.

  • Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?

    18
    0 Votes
    18 Posts
    3k Views
    PeterJonesP

    @Jens-Kallup said in Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?:

    I don’t know why is that so,

    The PythonScript documentation explains that you have to add it to the menu in order to make a shortcut.

    If that’s not enough of an explanation as to why: it’s because the Notepad++ Shortcut Mapper will only go as deep as Top Level > Next Level > Action for mapping a shortcut to the action; in this case, Top Level is Plugins and Next Level is Python Script, so an Action has to be in the Python Script level of the menu system for the Shortcut Mapper to be able to see it.

    @Ekopalypse ,

    Complete, detailed, simply good.

    Thanks.

  • Compare Plugin - creates 8 invisible buttons in toolbar

    3
    0 Votes
    3 Posts
    588 Views
    ManOfLardM

    Perfect. Although the same is true of “not Dark” mode. I surmise that the developer hasn’t added any Fluent icons.