• Replacing Tidy plugin

    3
    0 Votes
    3 Posts
    5k Views
    PeterJonesP

    Nope, never used it. When I want to manipulate the text with an external utility, I tend to use NppExec or PythonScript plugins.

    What did you try before you asked the question? Have you tried anything in the month since then? What works, what doesn’t? (People in help forums usually like seeing that you’ve put in effort yourself. Besides, it helps them reproduce your problem, and gives a good starting place for where to go next.)

    However, even though I’ve never used it, I took a 2minute look at the pork2sausage.ini, and it comes with pretty good documentation in the comments section. Here’s how I understand the parameters, after those 2 minutes:

    progPath: full path to the executable you want to run. He used the example of java.exe, but that’s where you’d give the full path to tidy.exe (or whatever Tidy’s executable is called) progCommand: the command you wanted to run. He used an example of calling a specific java class, but you would use something like tiny --option 1 -- something else "$(SELECTION)" workDir: what directory do you want it to run in progInput and progOutput: if you have whole files you want to use, this is where you’d specify them. But that’s if tidy were expecting filenames, and could not handle command-line arguments.

    I know nothing about the tidy executable, so let’s pretend I had a program called transform which takes as its argument a single string, and outputs some transform of the string on STDOUT. My .ini would be something like (untested, since I’ve never used pork2sausage, and haven’t downloaded it)

    [xfrm] progPath=C:\Program Files\TransForm\transform.exe progCmd=transform "$(SELECTION)" workDir=C:\Program Files\TransForm\

    You would then select some text, and run the pork2sausage using “xfrm” (I don’t know how to do that part; presumably, Plugins > Pork2Sausage > xfrm).

    Given that tidying HTML probably wants the whole file, rather than a small selection, and passing newlines over the command line is difficult, you’d be more likely to want the progInput / progOutput version: but then you’d need to always save the file to whatever’s defined in progInput. But at that point, I’d probably switch to NppExec, with something like this command, which I use to take the entire contents of the currently active file, encrypt it using gpg.exe, and paste it back into the active document (and save):

    cls npp_save cmd.exe /c exit %RANDOM% // cannot access $(SYS.RANDOM) directly through NppExec, but can tell cmd.exe to return it as a value set tempfile = $(SYS.TEMP)\NppGpgFile_$(EXITCODE).tmp // create random tempfile name set ascfile = $(SYS.TEMP)\NppGpgFile_$(EXITCODE).asc // create associated ascfile name sci_sendmsg SCI_SELECTALL // select all sel_saveto $(tempfile) :a // save selection to the tempfile (use :a to save as ansi, to prevent unicode prefix ÿþ getting embedded) INPUTBOX "Recipients (use -r between multiple): " : email@address // get the recipients gpg.exe --output "$(ascfile)" -ase -r $(INPUT) "$(tempfile)" // armor+sign+encrypt to recipient(s) sel_loadfrom $(ascfile) // replace selection with results sci_sendmsg SCI_DOCUMENTSTART // deselect //rm -rf "$(tempfile)" "$(ascfile)" // cleanup temp files npp_save
  • How convert accents and others chars to utf8

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    crystalfpC

    Do you mean your file contains a mixture of utf8 and non-utf8 characters?
    Have you tried to convert the file encoding to the one of your non-utf8 characters and then back to utf8?
    Hope it helps. mario

  • Scroll screen not getting the cursor to bottom or top

    2
    0 Votes
    2 Posts
    1k 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
    641 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
    816 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
    1k 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
    847 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
    759 Views
    Felixx61F

    Solved, please disregard

  • 0 Votes
    2 Posts
    818 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
    19k 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…