• Update stopped working under 7.5.9

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    Meta ChuhM

    @Eko-palypse
    theory confirmed ;-)

    @Craig-Williams
    there are major changes to the internal folder structures of notepad++, like autoCompletion and plugins, so an update to 7.6.+ means that you will have to move your existing plugins, and their custom configurations (if any exist) as well as any custom autoCompletion files to the new locations, and therefore this update should not be triggered automatically yet, as it is more of a “migration” than a normal update that’s suitable for all users.

    if you are ready to migrate, you can use the 7.6.2 installer of your choice from here and use it as updater to install over your existing notepad++.

    we will assist you if you have any problems migrating and you can’t find the correct solution in this forum.

  • Ignore Prefix or Suffix Characters

    Locked
    13
    0 Votes
    13 Posts
    3k Views
    Meta ChuhM

    @aclark13

    Unfortunately the functions in these scripts don’t use a ( so that might not work.

    the only (dirty) workaround i’ve been able to come up with, is to temporarily type an (after your function if you want to view your calltip/parameter hint or mini manual, then press backspace to remove the ( and resume with the correct syntax.

    your key word (target in this example) will stay black as long as you keep the bracket there, so it’s easy to spot if you forget to remove the opening bracket once in a while with this q’n’d workaround.

    Imgur

    please keep us informed if you come up with anything more suitable for this case.

    btw.: here’s a link to the (pretty old) autocompletion wiki if it helps:
    http://docs.notepad-plus-plus.org/index.php/Auto_Completion

  • no output when using kivy in python in notepad++

    Locked
    16
    1 Votes
    16 Posts
    2k Views
    Sean LaceyS

    it worked thank you so much

  • 0 Votes
    2 Posts
    516 Views
    Eko palypseE

    @viveksejpal said:

    not sure if this can be done easily with out modifying the npp source code.
    For example you still generate

    \BoostRegexSearch.obj

  • function list - how to get a text to identify the function

    6
    0 Votes
    6 Posts
    813 Views
    Eko palypseE

    jN Notepad++ plugin might be a good starting point for you.

  • 1 Votes
    11 Posts
    2k Views
    Eric BornE

    @alan-kilborn said:

    How exactly does the script do this? Does it invoke the menu commands for styling? I ask because, since you are apparently adept at scripting, you could do the styling in a more manual way, and thus avoid limitations about case sensitive/insensitive that you are seeing. Had this not occurred to you?

    Due to not knowing how to do it (newbie in PythonScript/Scintille), and having found an example that used the MENUCOMMAND.SEARCH_MARKALLEXT1…5, I originally came up with next:
    # Code in startup.py
    # not shown: some code to read the keywords from the top of the result-file...
    # then next (dirty) code performed the coloring, albeit case sensitive:
    iColorIndex = 1
    for keyword in lstKeywords:
    editor.gotoPos(startpos)
    editor.setAnchor(startpos+len(keyword))
    exec('notepad.menuCommand( MENUCOMMAND.SEARCH_MARKALLEXT%d )' % iColorIndex) # color 1..cnst_MaxColors
    iColorIndex += 1
    if iColorIndex > cnst_MaxColors:
    break
    startpos += len(keyword) + 1 # +1 for the space

    Your tip about the SendKeys Python library: I definitely will check this out (on my todo-list).

    @guy038

    I probably mis-wrote my point: as @alan-kilborn said, I liked to have it done w/o any manual intervention.
    But thx for your neat comments anyway:)

    @alan-kilborn

    Didn’t know about the functionality of the editor.XXX_indicator_XXX() Scintilla commands.
    So I tested your “example”: it DOES THE JOB perfectly!
    In your code, we are not dependent anymore of any settings bit, because “re.I” is specified explicitly, brilliant!

    So you supplied the perfect solution and I am very grateful for this!

    To explain how my piece of the startup.py code works, here a shot of the first few lines of a “result-file” I mentioned earlier, though I couldn’t achieve the formatting like it is shown in my launched Notepad++:
    (note: my apologies for the bad formatting, but I have no skills on this whatsoever, read little in the help, then came up with next)

    ##LANGUAGE=SERESULTS
    Runtime: 0.10 s
    SE.py version V01.01
    User arguments: script python startup
    Used arguments: script python startup
    TotalMatches = 631 (displayed = 44)
    SkipsFor(+) = 0
    SkipsFor(-) = 0
    -------------------------------------------------------------------
    #Header
    #Date 2018/12/14
    #Title
    #Keywords ORGIIIEGB IIITTIMMERS warning Notepad++ plugins PythonScript PluginManager PythonScript_1.0.8.0.msi specialties features files NiceToKnows problems startup
    #Body
    2015/09/11:
    NEVER install pythonScript using the PluginManager, because that gives problems!
    Instead, use the installer PythonScript_1.0.8.0.msi (Stop Notepad++, execute this .msi, then start Notepad++ again))
    ` Configfile:` ` C:\Users\borne\AppData\Roaming\Notepad++\plugins\config\PythonScriptStartup.cnf` ` startup.py:` ` C:\Program Files (x86)\Notepad++\plugins\PythonScript\scripts\startup.py`
    #EndBody
    -------------------------------------------------------------------
    #Header
    #Date 2018/12/21
    #Title todo Turning a python script into a website
    #Keywords ORGIIIEGB todo Turning a python script into a website
    #Body
    todo: try this out:
    https://blog.pythonanywhere.com/169/
    #EndBody
    -------------------------------------------------------------------
    #Header
    #Date 2018/12/20
    #Title
    #Keywords ORGIIIEGB C:\db\Python_Sources\Notepad++PluginPythonScript\Examples\ BracketHighlighter.py ColumnLexer.py CTags Based Autocompletion.py Disable Virtual Space.py Enable Virtual Space.py EnhancedPythonLexer.py Event Handler Demo.py Formatter.py HideLines.py InsertRuler.py LogfileLexer.py MultiEdit.py Python Regex Replacements.py RegexTester.py Remove and Modify selected lines.py ReplaceDefaultReplaceDialog.py Sorter.py StartWithLocalPython.py Swap2Words.py
    #Body
    C:\db\Python_Sources\Notepad++PluginPythonScript\Examples\
    BracketHighlighter.py
    ColumnLexer.py
    CTags Based Autocompletion.py

    (note that the structured database text file is almost the same:
    strip off the part before the first ‘-------------’ and replace all lines ‘-----------’ with empty lines)

    And here is the resulting startup.py containing your EXCELLENT solution:

    # The lines up to and including sys.stderr should always come first # Then any errors that occur later get reported to the console # If you'd prefer to report errors to a file, you can do that instead here. import sys from Npp import * import traceback import re # Set the stderr to the normal console as early as possible, in case of early errors sys.stderr = console # Define a class for writing to the console in red class ConsoleError: def __init__(self): global console self._console = console; def write(self, text): self._console.writeError(text); # Set the stderr to write errors in red sys.stderr = ConsoleError() # This imports the "normal" functions, including "help" import site # This sets the stdout to be the currently active document, so print "hello world", # will insert "hello world" at the current cursor position of the current document sys.stdout = editor #def switch_language_view(args): # notepad.activateBufferID(args["bufferID"]) # lineone = editor.getLine(0) # if '##' in lineone: # #lineone = lineone[lineone.rfind('##'):].replace('##', '') # language = lineone[lineone.rfind('=')+1:] # #lineone = "MENUCOMMAND." + lineone.upper() # try: # #notepad.menuCommand( eval(lineone) ) # #notepad.menuCommand(lineone) # notepad.runMenuCommand("Language", language) # except: # pass def style(x): return 26 - x def match_found(m): editor.indicatorFillRange(m.span(0)[0], m.span(0)[1] - m.span(0)[0]) ##command to link notification #notepad.callback(switch_language_view, [NOTIFICATION.FILEOPENED]) #editor.indicatorClearRange(0, editor.getTextLength()) skip this, as nothing is colored yet try: sFirstLinesOfDoc = editor.getTextRange(0,255) sTarget1 = '##LANGUAGE=SERESULTS' sTarget2 = 'Used arguments: ' pos = sFirstLinesOfDoc.find(sTarget1) if pos == 0: # ok, we are probably dealing with a results file, so continue processing cnst_FirstStyle = 1 cnst_MaxStyles = 5 # 5 Token Styles (== Scintilla indicators, thx @Alan-Kilborn) pos = sFirstLinesOfDoc.find(sTarget2) if pos >= 0: # also found this, so way to go startpos = pos + len(sTarget2) endpos = sFirstLinesOfDoc.find('\r\n', startpos) lstKeywords = sFirstLinesOfDoc[startpos:endpos].split() currentStyle = cnst_FirstStyle for keyword in lstKeywords: editor.setIndicatorCurrent(style(currentStyle)) editor.research(r'\Q' + keyword, match_found, re.I) currentStyle += 1 if currentStyle > cnst_MaxStyles: break except: # next error processing code doesn't work: # - no error can be seen afterwards, even not in the console when it is instructed to open automatically when an error occurs # (note: the console then opens correctly, but no error appears) # - also editor.insertText() doesn't work from this exception-block strError = r'Exception in file C:\Program Files (x86)\Notepad++\plugins\PythonScript\scripts\startup.py' strError += '\n' + traceback.format_exc(100) + '\n' editor.insertText(0, strError) # insert the error at top of file print strError

    @alan-kilborn said:
    …Scintilla is not to blame for any case-sensitive problems…

    Of course, you’re right.
    I never want to blame anything or anybody, not to mention the fact, that my interpretation often differs from authors’ intention, so I rather play it safe and fair with the gap in between :)

    Recap: I am very grateful for your help, gentleman! I am glad that there are people like you, reading problems and react very professionally! (payed services are often worse!)

    As a thank you, if you would like to test the searchtool out yourself, let me know how and I’m glad to send you a copy!

  • Replace every X(th) line in file 1 with every X(th) line from file 2

    18
    0 Votes
    18 Posts
    3k Views
    guy038G

    @swen-reindl, @terry-r, @perterjones and All,

    The drawback of my first method is that you needed very similar structure of the two files, in order to keep a constant gap between the line to replace and the line which must replace it :-(

    So, here is my second attempt, which needs two regex S/R but which can be used in all cases, whatever the file’s structure ! Indeed, it simply :

    Searches for the first line, beginning with the vertex string, after a line outer loop, in File 1

    Replace that line with the first line, beginning with the vertex string, after a line outer loop, in File 2

    Copy the File 1 contents in a new N++ tab

    Add a simple line of, at least, 3 tildes, right after the contents

    Now, append the File 2 contents, right after the line of tildes

    So, let’s suppose that we get this sample text, where I added some bla bla bla lines, at random locations

    # File 1 facet normal 0 0 -1 bla bla bla bla blah outer loop bla bla bla bla blah vertex 0 -4.7850790023803711 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex -8.2880001068115234 -9.5701580047607422 3.5992410182952881 vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 endloop bla bla bla bla blah endfacet facet normal 0 0 -1 outer loop bla bla bla bla blah bla bla bla bla blah bla bla bla bla blah vertex 0 4.7850785255432129 3.5992410182952881 vertex 8.2880001068115234 -2.384185791015625e-07 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex 0 -4.7850790023803711 3.5992410182952881 endloop endfacet bla bla bla bla blah bla bla bla bla blah facet normal 0 0 -1 outer loop vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex 0 4.7850785255432129 3.5992410182952881 vertex 0 -4.7850790023803711 3.5992410182952881 endloop bla bla bla bla blah endfacet ~~~~~~~~~~ # File 2 facet normal -0 -0 -1 outer loop bla bla bla bla blah bla bla bla bla blah vertex 0 4.7850790023803711 0 bla bla bla bla blah vertex 8.2880001068115234 9.5701580047607422 0 vertex 8.2880001068115234 -9.5701580047607422 0 endloop endfacet facet normal -0 -0 -1 outer loop vertex 0 -4.7850785255432129 0 bla bla bla bla blah bla bla bla bla blah bla bla bla bla blah vertex -8.2880001068115234 2.384185791015625e-07 0 vertex 0 4.7850790023803711 0 endloop endfacet facet normal -0 -0 -1 bla bla bla bla blah bla bla bla bla blah bla bla bla bla blah outer loop bla bla bla bla blah vertex 8.2880001068115234 -9.5701580047607422 0 vertex 0 -4.7850785255432129 0 vertex 0 4.7850790023803711 0 endloop bla bla bla bla blah bla bla bla bla blah endfacet

    Now , open the Replace dialog ( Ctrl + H )

    Type in the regex (?s).+?(?|(\R~~~+)|outer loop.*?(?-s)(\Rvertex .+))|(?s).+ , in the Find what: zone

    Type in the regex \1 , in the Replace with: zone

    Check the Wrap around option

    Select the Regular expression search mode

    Click, once, on the Replace All button

    You should obtain this shorter text, with only the lines which need to be replaced and their counterparts which must replace them ;-))

    vertex 0 -4.7850790023803711 3.5992410182952881 vertex 0 4.7850785255432129 3.5992410182952881 vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 ~~~~~~~~~~ vertex 0 4.7850790023803711 0 vertex 0 -4.7850785255432129 0 vertex 8.2880001068115234 -9.5701580047607422 0

    Then , it’s fairly obvious :

    Insert the File 1 contents at the very beginning of that new tab

    Add, again, a simple line of, at least, 3 tildes, right after the contents

    Hence, the new tab contents becomes :

    # File 1 facet normal 0 0 -1 bla bla bla bla blah outer loop bla bla bla bla blah vertex 0 -4.7850790023803711 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex -8.2880001068115234 -9.5701580047607422 3.5992410182952881 vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 endloop bla bla bla bla blah endfacet facet normal 0 0 -1 outer loop bla bla bla bla blah bla bla bla bla blah bla bla bla bla blah vertex 0 4.7850785255432129 3.5992410182952881 vertex 8.2880001068115234 -2.384185791015625e-07 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex 0 -4.7850790023803711 3.5992410182952881 endloop endfacet bla bla bla bla blah bla bla bla bla blah facet normal 0 0 -1 outer loop vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex 0 4.7850785255432129 3.5992410182952881 vertex 0 -4.7850790023803711 3.5992410182952881 endloop bla bla bla bla blah endfacet ~~~~~~~~~~ vertex 0 -4.7850790023803711 3.5992410182952881 vertex 0 4.7850785255432129 3.5992410182952881 vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 ~~~~~~~~~~ vertex 0 4.7850790023803711 0 vertex 0 -4.7850785255432129 0 vertex 8.2880001068115234 -9.5701580047607422 0

    Open, again, the Replace dialog ( Ctrl + H )

    Type in the regex ^outer loop(?s).*?\K(?-s)(^vertex.+)(?=(?s:\R.+?\R~~~.+?)\1\R(?:.+\R){3}(.+))|(?s)^~~~.+ , in the Find what: zone

    Type in the regex \2 , in the Replace with: zone

    Check the Wrap around option

    Select the Regular expression search mode

    Click, once, on the Replace All button ( Do NOT use the Replace button, because of the \K feature in the search regex )

    Here we are ! We get, in our new tab, just the new File 1 contents, after all the replacements ;-))

    # File 1 facet normal 0 0 -1 bla bla bla bla blah outer loop bla bla bla bla blah vertex 0 4.7850790023803711 0 bla bla bla bla blah bla bla bla bla blah vertex -8.2880001068115234 -9.5701580047607422 3.5992410182952881 vertex -8.2880001068115234 9.5701580047607422 3.5992410182952881 endloop bla bla bla bla blah endfacet facet normal 0 0 -1 outer loop bla bla bla bla blah bla bla bla bla blah bla bla bla bla blah vertex 0 -4.7850785255432129 0 vertex 8.2880001068115234 -2.384185791015625e-07 3.5992410182952881 bla bla bla bla blah bla bla bla bla blah vertex 0 -4.7850790023803711 3.5992410182952881 endloop endfacet bla bla bla bla blah bla bla bla bla blah facet normal 0 0 -1 outer loop vertex 8.2880001068115234 -9.5701580047607422 0 bla bla bla bla blah bla bla bla bla blah vertex 0 4.7850785255432129 3.5992410182952881 vertex 0 -4.7850790023803711 3.5992410182952881 endloop bla bla bla bla blah endfacet

    Note that the {3} quantifier, in the search regex, is, exactly, the number of vertex......... lines which must be modified. So, the number 3 in that present example

    Cheers,

    guy038

  • Help with regex and find/replace

    Locked
    3
    0 Votes
    3 Posts
    636 Views
    MassimoM

    @PeterJones said:

    Welcom, @Massimo,

    I am assuming those are really normal-quotes, not smart-quotes. Please see this awesome thread which explains how to use markdown to format your posts, so that the forum doesn’t change you important characters into smart characters.

    Hi Peter, thanks for your help!

    Are smart-quotes that in dabase are saved as

    '

    This worked perfectly!

    Find

    data='([^']*)' pid='([^']*)' dateline='([^']*)'

    Replace with

    data=$1 link=msg=$2 date=$3

    Thanks again 😉

  • Converting columns to rows in a text file

    Locked
    2
    0 Votes
    2 Posts
    4k Views
    Terry RT

    @Trevor-Friswell
    there are a couple of ways of attacking this issue.

    First would be to open the CSV file in a spreadsheet app, likely Excel, but Open Office would also work. This would then put each field in a separate column. Then you’d pick 1 column at a time and save the data to a txt file.

    Second method is using Notepad++ to alter the data to suit by changing the commas separating each field into a “CR/LF”. I would also include an additional line feed at the end of each row, so that subsequent editing of the data could use this to help divide up the data in the separate files. Prepending a number at the beginning of each line (1 through 9) using the blank line would allow for a new sort of the lines to put them in the “file” groups. This is only a concept and may well require adjustment as one ventures through to a solution. Given some fields might have quotes around them if they have a comma within the data can further complicate matters.

    Personally, given the small amount of information you have provided I would go with the Excel idea.

    Note I haven’t actually provided any regexes (regular expressions) as obviously the example you provided is simplified (not real). All too often we try to help users where the information is limited, only to be told by the OP that in fact they “really need to do…” or that “the real data actually looks like…”. That is extremely frustrating and wasteful of time, often it can result in throwing out the solution, going back to the drawing board and designing another solution.

    I would like to point you to our FAQ, specifically:
    https://notepad-plus-plus.org/community/topic/15739/faq-desk-request-for-help-without-sufficient-information-to-help-you
    Please read that and if needing to provide more realistic data use the formatting suggestion so that the interpreter here does NOT alter your data.

    Terry

  • Editing in Notepad++

    9
    0 Votes
    9 Posts
    2k Views
    PeterJonesP

    You’re welcome, @Inshita-Rawat. If you follow the links in the FAQ, especially to one of the try-it-live websites, like regexr.com (*), they will explain the individual elements of the regular expression in great detail.

    *: I usually use regexr, and switch it from “JAVASCRIPT” to “PCRE” in the upper right. PCRE comes come close to Notepad++'s Boost-based regular expressions — since both Boost and PCRE are based on Perl regular expressions, though there are differences (both from each other, and from Perl).

    If you paste my ^(.*?) (\d.*) regular expression into regexr.com with PCRE, and FLAGS=global,multiline (/gm), along with example data – see https://regexr.com/466oe – you can see the explanation, or by clicking on REPLACE, you can input my replace string, and see what it will become.

  • Can not change UI Language to ChineseSimplified.

    1
    0 Votes
    1 Posts
    312 Views
    No one has replied
  • geektyper for notepad++ ?

    2
    0 Votes
    2 Posts
    759 Views
  • 0 Votes
    4 Posts
    2k Views
    Semper RotoS

    Hey @Meta-Chuh and @guy038,
    that’s some great news you sharing. I certainly will look into this.
    Thanks for the quick help.

    Best regards.

  • Keyboard map chords (e.g., Ctrl+X Ctrl+C)

    16
    0 Votes
    16 Posts
    4k Views
    Mikhail VM

    @Alan-Kilborn said:

    editor.styleSetBack(STYLESCOMMON.LINENUMBER, (255, 0, 0))

    will turn the background of the line-number margin a rather glaring red, for example.

    Yes, changing the line number color is actually better solution in general and it can be better visible.
    I’ve used folder margin from the beginning and just was too lazy to experiment further :)
    BTW, if you want to make permanently visible folder margin in any file, it can be done with Pythonscript plugin via “startup.py” script.

    Disable folder margin:
    Settings - > Preference -> Editing : set “Folder margin style” to “None” Add e.g. this to startup.py: editor.setMarginWidthN (2, 16) # set folder margin to 16 pixel editor.markerDefine (MARKEROUTLINE.FOLDEROPEN, MARKERSYMBOL.ARROWDOWN) editor.markerDefine (MARKEROUTLINE.FOLDERSUB, MARKERSYMBOL.EMPTY) editor.markerDefine (MARKEROUTLINE.FOLDERTAIL, MARKERSYMBOL.EMPTY) ...

    then Restart Npp. So can even define custom marker symbols or just set them all to EMPTY.
    see:
    https://www.scintilla.org/ScintillaDoc.html#Markers
    http://npppythonscript.sourceforge.net/docs/latest/enums.html#markeroutline

  • The strange behavior of the cursor in the Notepad + + window

    39
    0 Votes
    39 Posts
    13k Views
    andrecool-68A

    @SinghRajenM said:
    I do not have such an error

  • I am having trouble with notepad++

    2
    0 Votes
    2 Posts
    426 Views
    Alan KilbornA

    @KOMN-W said:

    I am having trouble with notepad++

    But you didn’t say anything about the trouble you’re having with Notepad++!

  • How to automatic open more files with one click

    1
    0 Votes
    1 Posts
    367 Views
    No one has replied
  • Delete all lines except

    16
    0 Votes
    16 Posts
    4k Views
    Meta ChuhM

    @PeterJones

    since two of the forum’s python experts are not actively helping here anymore, I need to up my PythonScript output …

    i really wished there was an easy way to lure both back somehow … for example with a complementary free cake for all returning members 🥧🍰🎂 :D

    i’ve still got the hope that someday maybe one or both will return for either historic, good times reasons, or 'cause you lured them back with future’s most ultimate py guru knowledge 👍
    (ps: no pressure, i think your py is already pretty good and way better than eg. mine)

    reader’s note:
    this was slightly off topic, so i give my sincere apologies to everyone in advance.

  • Issue when copypasting from excel to notepad++

    Locked
    7
    0 Votes
    7 Posts
    6k Views
    Meta ChuhM

    thanks @PeterJones , now i can reproduce.
    (i barely use excel so i didn’t even now that you can put a tab or a new line in a cell ;-) )

    now i definitively second your first suggestion using regex to replace the pairs of quotes:

    If you only want to get rid of matched quote pairs, then enable search mode = regular expression, and set find what=“([^”]*)" and replace with=$1. (edit: to clarify, the quote marks around the parenthesis are part of the search-string, so you should type those, too)

  • Regex to delete sections of XML

    8
    0 Votes
    8 Posts
    3k Views
    Christopher PhillipsC

    @guy038 said:

    Thanks @guy038 you are a star. I misread and thought everything needed to be on a single line. You new regex works perfectly.