• Scroll screen not getting the cursor to bottom or top

    2
    0 Votes
    2 Posts
    965 Views
    Mikhail VM

    Yes. There are Scintilla commands to set this.
    https://www.scintilla.org/ScintillaDoc.html#ScrollingAndAutomaticScrolling

    This one is needed:

    SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)

    Though I am not sure how to make it auto-run in NPP directly.
    I only know how to do it using the PythonScript plugin.
    https://github.com/bruderstein/PythonScript

    If you have it installed, then open “startup.py” script and put these lines
    somewhere in the bottom:

    editor.setEndAtLastLine(0) editor.setYCaretPolicy(13, 5) # set scroll offset to 5

    Also set “Initialization: ATSTARTUP” in the plugin Configurarion menu.

    This will set scroll offset to 5 lines (so change 5 in the second line to something else if needed).

  • Replacing partial lines

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    guy038G

    Hello, @donny-tee, and All,

    If all your lines, beginning with the number 23, follow the same template, that’s quite easy, my President !

    SEARCH (?-s)^23\x20.+

    REPLACE 23 -0.308254 -0.007814 0.307166 -0.110578 -0.404637 -2.460353

    Notes :

    First, the (?-s) modifier means that the regex dot symbol (. ) matches a single standard character, only ( and not an EOL char )

    Then the part ^23\x20 matches the number 23, followed with a space character ( you may replace \x20 with a true space )

    Finally, the part .+ ( or .{1,} ) matches the non-empty remaining of each line, beginning with the number 23

    Best Regards,

    guy038

    P.S.

    It would be nice, President, if all your problems could be solved, in a similar way ;-)) Peoples and planet would just go on, living in peace !

  • Help locating a letter and number string

    Locked
    5
    0 Votes
    5 Posts
    1k Views
    guy038G

    Hello, @angela-davis

    Assuming there is NO condition on the choice of lines, this following regex S/R swaps, for instance, the next 2 lines till the final block of two lines of the current file

    SEARCH (?-s)^(.*\R)(.+\R)

    REPLACE \2\1

    So, given the sample text, below, with the cursor located before the string 1A :

    1A This is a 1B simple text 2A in order to 2B understand 3A how the 3B text changes

    You should get :

    1B simple text 1A This is a 2B understand 2A in order to 3B text changes 3A how the

    Best regards,

    guy038

  • Problem using Spell-Check + Aspell

    2
    0 Votes
    2 Posts
    617 Views
    Terry RT

    It sounds like you are trying to get the dictionary to “learn” new words. This would entail it opening and writing to a file. If this is the first time you’ve tried this (as you say) the error probably means it’s not even able to create the file, hence why you cannot find the file.

    So look for the “Aspell” folder, that’s part of the error message you get, hopefully some other files already exist there. Using an external program (Windows Explorer maybe) attempt to write a text file in that folder, you will probably get a similar error message, “unable to create file”. If that happens it will prove it’s not a Notepad++ issue, rather a Operating System permissions problem which will need fixing/adjusting.

    Terry

  • Regex: Select all the words that doesn't have . in front of

    Locked
    3
    0 Votes
    3 Posts
    789 Views
    Vasile CarausV

    Got it.

    FIND: \w+([^.#"</ ])(?=html)

    this will find all words html that has only letters before it, such as my-babyhtml

    will not match words like #html or <html or "html

  • SCORM File Editing

    Locked
    3
    0 Votes
    3 Posts
    983 Views
    Brandon ChavezB

    Outstanding advice! I was assuming it had something to do with the format I was editing it, eg: UTF-32, UTF-16 or ASCII formats. I tried a few with no luck. I will do as you say and see if there is a difference in the files after editing the two utilizing Notepad vs. Notepad++. I also assumed that the SCORM manifest was checking file size as well, however I couldn’t find any evidence of that happening, plus that wouldn’t make sense that I could edit with Notepad without any issue.

    I appreciate your response, will definitely do this!

  • Language not being saved with file

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    PeterJonesP

    NPP does not save a per-file language-lexer choice. The lexer used is determined by the extension lists in the settings for each Language > Define your language... > Ext : (for a given User Defined Language, UDL), and in the Settings > Style Configurator > User ext. and Default ext. (for a given Language lexer).

    A User ext. in the Configurator or an Ext. : in the UDL settings will override a Default ext.. If an extension isn’t found in the user extensions or UDL extensions, NPP will search the default extension lists, and hand the file off to the appropriate lexer, if found. If an extension isn’t in any of the lists, then it will be handled as a Normal text file.

    So, if you’ve set Ext. : = txt in the User-Defined Language AutoHotKey, then NPP will use the AutoHotKey UDL for the highlighting whenever you open a .txt file, rather than going thru the list of priorities down to the Normal text.

    If you don’t want NPP to apply the AutoHotKey formatting to .txt files, you have to make sure that you remove txt from the User-Defined Language settings for the AutoHotKey (and any other user-defined language or style-configurator language).

    If you want NPP to apply AutoHotKey to some .txt files, but Normal Text to others, that’s more than NPP is programmed to do. You will have to toggle some of the .txt files manually; or you might be able to figure out a way to program a PythonScript or LuaScript to recognize the specific content when a .txt file is opened, and to have the script tell NPP to either use the AutoHotKey highlighting or Normal Text…) Notepad++'s expectation is that files that want different highlighting will have different extensions (so maybe choose .ahk for AutoHotKey files – though, since I don’t know how AHK works, I don’t know if it has a default file extension, or whether it doesn’t care, or whether it only accepts .txt files).

  • php additional syntax highlighting

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    What categories there are available for a given language are defined by that language’s lexer; unfortunately, you cannot add new categories. (Well, like you saw, you can add anything you like to stylers.xml… but if the php lexer isn’t programmed to match words in that category, and to pass on the category to scintilla to mark it with a particular style, nothing will happen.)

    Many of the languages allow adding new keywords to a given category; in php, if you wait long enough on the WORD style, it pops up the default and user-defined keyword lists, so you could add words to that category – however, I don’t see that it’s implemented any other styles of keywords.

    So, with the builtin lexer, I don’t think you’re going to be able to add a separate style/category of keywords, sorry.

    You might be able to come up with a UDL to highlight the words as you desire (but UDL highlighting often falls short in areas that the custom lexers excel in, so you may have to give up something in order to get the two different categories of keywords).

  • I need help trying to run Python in Notepad++

    Locked
    1
    0 Votes
    1 Posts
    823 Views
    No one has replied
  • Quick delete/replace of lines in GPX/TCX file ?

    Locked
    4
    0 Votes
    4 Posts
    1k Views
    Terry RT

    Sorry, I need to revise slightly my previous answer. If you follow that solution you will finish with 2 lines combined. I’ve actually considered a slightly better answer.

    Find: (\R)\R+
    Replace: \1

    What this does is find the first CR/LF (you may need to replace \R with the correct CR/LF character your file has). Then there has to be 1 or more additional CR/LF characters. We only keep the first CR/LF character, removing all others. This will cater for situation of multiple empty lines together, as \R+ greedily consumes as many CR/LF characters as possible.

    I have to ask the question though, is the line truly empty or does it have 1 or more spaces in it? Spaces will require a different expression. If spaces then:
    Find: (\R)\h*\R+
    Replace: \1
    The caveat here is that \h refers to both a horizontal space, a tab and a line feed. Depending on the character set used a \h might also refer to part of your CR/LF. If so then replacing \h with \s might fix it.

    Terry

  • 0 Votes
    5 Posts
    2k Views
    Dillon EthierD

    Thank you very much! This is an adequate solution.

  • Search/Replace after ignored string

    Locked
    2
    0 Votes
    2 Posts
    709 Views
    Felixx61F

    Solved, please disregard

  • 0 Votes
    2 Posts
    781 Views
    Fade To-GrayF

    My bad - I failed to copy over the global.xml file :-/

  • regex: compare lines and find out different numbers

    11
    1 Votes
    11 Posts
    3k Views
    Vasile CarausV

    thanks guy, your solution is ok, but complex. I just found another solution.

    <li><a href=".*\.html" title=".*">.* (?:(?!\b(22|9|15|23|4|15)\b).)*<\/a><\/li>$

    Check this out: https://regex101.com/r/vRXKWj/4/

  • TextFX doesn't work

    12
    3 Votes
    12 Posts
    5k Views
    guy038G

    Hi, @Scott-sumner

    I do not understand what you mean ?

    I did added the part :

    separator = notepad.prompt('Enter the separator string, between columns:', ps_name, ',') if separator == None or len(result) == 0: return

    and I changed the lines :

    line = delimiter.join(new_interdelimiter_list) else: line = delimiter.join(old_interdelimiter_list)

    as :

    line = separator.join(new_interdelimiter_list) else: line = separator.join(old_interdelimiter_list)

    Not a great task, I agree, but, however, significant… and it works nice ;-))

    BR

    guy038

  • How to remove text between two specified strings using Notepad++?

    Locked
    3
    0 Votes
    3 Posts
    12k Views
    guy038G

    Hello, @pratap-chava and All,

    Regarding your needs, I think that a suitable regex S/R could be :

    SEARCH : (?s-i)^File created by.+?\RMessage log.+?$\R

    REPLACE Leave Empty

    Don’t forget to select the Regular expresion search mode and to tick the Wrap-around option

    Notes :

    At beginning of the regex, the modifiers (?s-i) mean that :

    The . dot regex character will match any single character ( Standard and EOL chars )

    The search is performed in a sensitive way. If you prefer insensitive matches just change that part with (?si) !

    Then the part File created by.+?\RMessage log looks, from beginning ( ^ ) of line, for any text, beginning with File created by and ending at the first expression Message log, preceded by a line-break ( \R )

    Now, the final part .*?$\R tries to match a range of any character, ending at the nearest end of line ( $ ), and followed with a line-break ( \R )

    And, due to the empty replacement zone, all that block of text is, then, simply deleted !

    Cheers,

    guy038

  • Keep “Remember current session” AND prompt to save unsaved files?

    Locked
    5
    0 Votes
    5 Posts
    6k Views
    Scott SumnerS

    @Matt-McDowall

    Suggestion: Consider the TakeNotes plugin.

  • Search/Replace of Multiline Text Blocs

    6
    0 Votes
    6 Posts
    18k Views
    Scott SumnerS

    @James-Faction said:

    but it wasn’t very intuitive

    So what are your ideas for making it more intuitive?

    line breaks should be handled by copy/paste to make the find and replace function vastly more useful

    What does this mean?

    We want to help but first we have to understand…

  • I don't see the highlighting for PHP, HTML,

    Locked
    8
    0 Votes
    8 Posts
    7k Views
    Jelle RubenJ

    @Mikhail-V Who thanks that was the Issue
    @PeterJones You also thanks for your help…

  • Replace the math expression with the calculated result

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    PeterJonesP

    There’s also a plugin for Notepad++ called MathPad, which can be installed via the Plugin Manager, with more info at it’s homepage. I don’t know whether it will meet your needs, but it’s something to look into.

    Here is me helping you write the script: study the VBScript and/or PowerShell script at the SuperUser question you linked. Tweak it, and see how those changes affect the results. Experiment until it no longer requires the quote marks. Continue experimenting until it does everything you want it to. If you have shown some effort, but still cannot get it to work, ask a question in an appropriate forum, where the topic is about the scripting language you are using (SuperUser/StackOverflow might be a good location).

    Some here would be able to use the PythonScript plugin to automate those calculations inside Notepad++. Others might suggest skipping the middle-man: if you have a file with 14000 instances, it might be simpler to run it through an offline script, which could be written in VBA, Python, Lua, Perl, or your favorite scripting language. But it might take a few hours to write something: and that brings me to my last point:

    But if by “help me to write a script” you mean, “write a script for me”, then you’ve come to the wrong place. It sounds like you’re asking for custom coding services, which will likely cost you something. Good luck in presenting the question, as framed (ie, without showing any effort of your own), in any coding forum and getting the exact script you want.