• Setting the encoding character set by "User Defined Language"

    3
    0 Votes
    3 Posts
    683 Views
    PeterJonesP

    @Hubert-Sack,

    Is it possible to set “Encoding -> Character Set” to “OEM-US” within / by setting in an “User Defined Language”?

    No, the encoding is not stored in or controlled by the User Defined Language (UDL), or by any of the builtin languages, either.

    Remember, the “language”, whether UDL or builtin language, is really a syntax highlighter: even if there is a requirement for some language to only use a certain encoding, that would be a requirement separate from its syntax. Syntax has to do with the words, tokens, commands, data, etc; encoding has to do with the mapping between bytes inside the file and the textual characters they represent: syntax is at a “higher level of abstraction” than encoding.

    so switching the encoding by a setting in “User Defined Language” is wanted

    The syntax parsing system itself (builtin or UDL) is encoding agnostic (cannot know about the encoding), because by the time the syntax parser is running, the bytes from the file have already been read and interpreted as characters by Notepad++ – and thus, it’s beyond the encoding stage. They work with characters, not with file-bytes.

    That said, you can automate many things in Notepad++ using plugins. For example, the PythonScript plugin allows you to run Python code which will affect the text and GUI. In this case, you could setup a PythonScript hook that runs during the File > Save event; this code could check to see if the file being saved is a UDL, and if it is then check if it’s your particular UDL, and if it is then it can change the encoding of the file to OEM-US.

    Once you install the PythonScript plugin, there are good help files included (Plugins > Python Script > Context-Help) which describe the various commands necessary; since you’re programming PLC, I am going to assume you know something about programming, and thus the simple Python syntax necessary shouldn’t be too difficult for you. If you need help on the Notepad+±related specifics, feel free to reply. But to get you started, look up the sections on “Handling Notifications” for a general overview, notepad.callback() for how to register the callback, “Enums > NOTIFICATION”, notepad.setEncoding() for changing the encoding, and notepad.getLangType()/.getLanguageName()/.getLanguageDesc() for identifying whether your UDL is active.

  • open selected file in default application

    24
    0 Votes
    24 Posts
    9k Views
  • Last opened files not opening

    7
    0 Votes
    7 Posts
    3k Views
    Nelson ChanN

    @PeterJones I checked the flag and it was already on so i clicked it off and back on and restarted NP++ and lo and behold it’s back to normal now!
    Thanks for your help.

  • Comments don't work?

    19
    0 Votes
    19 Posts
    22k Views
    Alan KilbornA

    @Dennis-Paroutsas

    It does work, but it isn’t (and can’t be) language aware.
    Thus if you always program in C-style languages you are all set.
    But if you code in several different languages you’d have to have different macros and different keycombos that invoke them.

    And, you have to highlight a line (or a block) before running the macro. It’s arguably easier to just press / and / and achieve the same thing, with no follow-on caret positioning needed.

  • Cost of Notepad++

    2
    0 Votes
    2 Posts
    172 Views
    Alan KilbornA

    @Kwabena-Asare

    Notepad++ is “donationware”. You may use it free of cost, but if you feel like it, you may make a donation by CLICKING HERE.

  • Merging or Joining every 7 lines in a text file using notepad++

    3
    0 Votes
    3 Posts
    352 Views
    guy038G

    Hello, @robert-baker, @alan-kilborn, and All,

    An other solution could be :

    SEARCH (?-i)\R+(?!EMAIL|\z)

    REPLACE \x20

    This alternate solution does not mind if additional line-break separates each section ;-))

    For instance, the input text :

    EMAIL: swmorton50@gmail.com CALLSIGN: AA4TI NAME: STEPHEN MORTON ADDRESS: 5644 CANTUCCI STREET ADDRESS-CITY: NOKOMIS ADDRESS-STATE-PROVINCE: FL ADDRESS-POSTALCODE: 34275 EMAIL: robertumpleby@tx.rr.com CALLSIGN: AA5AH NAME: ROBERT UMPLEBY ADDRESS: 1209 N WATERVIEW DR ADDRESS-CITY: RICHARDSON ADDRESS-STATE-PROVINCE: TX/DALLAS ADDRESS-POSTALCODE: 75080 EMAIL: aa5au@bellsouth.net CALLSIGN: AA5AU NAME: DON HILL ADDRESS: 2121 SUTHERLAND PLACE ADDRESS-CITY: HARVEY ADDRESS-STATE-PROVINCE: LA ADDRESS-POSTALCODE: 70058 EMAIL: rickmaxey51@yahoo.com CALLSIGN: AA5TL NAME: RICHARD MAXEY, JR. ADDRESS: 19708 MAHOGANY ST ADDRESS-CITY: BEND ADDRESS-STATE-PROVINCE: OR ADDRESS-POSTALCODE: 97702 EMAIL: AA1SU@arrl.net CALLSIGN: AA1SU NAME: PAUL N. GAYET ADDRESS: 11 CHERRY STREET ADDRESS-CITY: ESSEX JUNCTION ADDRESS-STATE-PROVINCE: VT ADDRESS-POSTALCODE: 05452 EMAIL: skeeter_1@yahoo.com CALLSIGN: AA3C NAME: RICHARD PETERS ADDRESS: 945 BEECHWOOD DR. ADDRESS-CITY: MURPHY ADDRESS-STATE-PROVINCE: TX ADDRESS-POSTALCODE: 75094

    would output :

    EMAIL: swmorton50@gmail.com CALLSIGN: AA4TI NAME: STEPHEN MORTON ADDRESS: 5644 CANTUCCI STREET ADDRESS-CITY: NOKOMIS ADDRESS-STATE-PROVINCE: FL ADDRESS-POSTALCODE: 34275 EMAIL: robertumpleby@tx.rr.com CALLSIGN: AA5AH NAME: ROBERT UMPLEBY ADDRESS: 1209 N WATERVIEW DR ADDRESS-CITY: RICHARDSON ADDRESS-STATE-PROVINCE: TX/DALLAS ADDRESS-POSTALCODE: 75080 EMAIL: aa5au@bellsouth.net CALLSIGN: AA5AU NAME: DON HILL ADDRESS: 2121 SUTHERLAND PLACE ADDRESS-CITY: HARVEY ADDRESS-STATE-PROVINCE: LA ADDRESS-POSTALCODE: 70058 EMAIL: rickmaxey51@yahoo.com CALLSIGN: AA5TL NAME: RICHARD MAXEY, JR. ADDRESS: 19708 MAHOGANY ST ADDRESS-CITY: BEND ADDRESS-STATE-PROVINCE: OR ADDRESS-POSTALCODE: 97702 EMAIL: AA1SU@arrl.net CALLSIGN: AA1SU NAME: PAUL N. GAYET ADDRESS: 11 CHERRY STREET ADDRESS-CITY: ESSEX JUNCTION ADDRESS-STATE-PROVINCE: VT ADDRESS-POSTALCODE: 05452 EMAIL: skeeter_1@yahoo.com CALLSIGN: AA3C NAME: RICHARD PETERS ADDRESS: 945 BEECHWOOD DR. ADDRESS-CITY: MURPHY ADDRESS-STATE-PROVINCE: TX ADDRESS-POSTALCODE: 75094

    Best Regards,

    guy038

  • 0 Votes
    5 Posts
    2k Views
    Michael TaylorM

    Found this that explains it:
    http://www.thealarmtech.com/forum/viewtopic.php?f=33&t=107

    Really helps for visualization.

  • Help with the Gmod lua lexer plugin

    1
    0 Votes
    1 Posts
    204 Views
    No one has replied
  • Answer: [Solved]

    2
    0 Votes
    2 Posts
    324 Views
    Alan KilbornA

    @Sid-Jetty

    Wasn’t that already answered in the linked-to thread?
    If you were going to contribute something related, why didn’t you do it in that other thread?
    Your answer really doesn’t add any new information.

  • regex - search and replace - "remember"?

    9
    0 Votes
    9 Posts
    3k Views
    Alan KilbornA

    @Adam-Yik said in regex - search and replace - "remember"?:

    it is very similar to Directory-based system such as windows 10. However, up to 9 files and folders can exist in a directory, and

    There is no such limitation in Windows, and it doesn’t have anything to do with regular expression processing. Please don’t spread misinformation.

  • Help with Regex Search and Replace

    3
    0 Votes
    3 Posts
    888 Views
    rderekpR

    You are my hero! It looks like this fixed my problem, thank you!

  • User defined language - recognize date and time stamp

    6
    0 Votes
    6 Posts
    2k Views
    EkopalypseE

    @Ninon_1977

    first you have to install PythonScript plugin from PluginAdmin.
    Then click Plugins->PythonScript->New Script
    give it a meaningful name and copy the content into the newly created document.

    Then follow the instructions in the script.
    Change the lexername and the regexes in the configuration area.
    Lexername must be exactly the same as shown in the language menu
    and use the regex from @PeterJones

    Something like this

    regexes[(0, (79, 175, 239))] = (r'\d{4}-\d{2}-\d{2} \d{2}:', 0)

    all other regexes from the example can be commented.

    (79, 175, 239) <-- this is the rgb color

    Execute the script via Plugins->Python Script->Scripts->YOUR_SCRIPT
    (needs to be done once per npp start only)

  • Delay when typing

    6
    0 Votes
    6 Posts
    421 Views
    Alan KilbornA

    @Donniel-Collera

    I think maybe @gurikbal-singh is trying to ask you to provide your Debug Info.

    That would be found by going to the ? menu and choosing Debug Info… and then in the resulting box clicking on the link that says “Copy debug info into clipboard”.

  • Autoindent missing?

    14
    1 Votes
    14 Posts
    1k Views
    Jane WhittakerJ

    @PeterJones
    Many thanks for this!

  • 0 Votes
    1 Posts
    175 Views
    No one has replied
  • Encoding says file is UTF8 but it's not

    5
    0 Votes
    5 Posts
    4k Views
    asbyonejjA

    @guy038 said in Encoding says file is UTF8 but it's not:

    UN-tick the option Apply to opened ANSI files in Settings > Preferences… > New Document > Encoding, if the UTF-8 option is ticked

    This was my case. I didn’t know this option. Thank you.

  • How to create Shortcut to open a specific file only?

    6
    0 Votes
    6 Posts
    4k Views
    reemaS inrakluKR

    @Alan-Kilborn Thanks for your reply. Leaving the file open has been my workaround so far. Yes, its my go to file and I would be lost without it :-)

    I will keep in mind your suggestions & tricks and will definitely come in handy.

  • Run MIME tools decoder on multiple files

    7
    0 Votes
    7 Posts
    3k Views
    trespdaT

    @PeterJones My test against a few dozen open files went well. I still got problems with certain characters, but the script run fine. Thanks again.

  • Remove useless Language Folders

    10
    0 Votes
    10 Posts
    3k Views
    PeterJonesP

    @PeterJones said in Remove useless Language Folders:

    It’s exactly what it means, and it’s exactly the opposite of what it means.

    I have issued doc PR#77, which among other things, clarifies the “Make Language menu compact” so it’s understood that combing that option with disabled languages might cause there to be empty-letter menus.

  • Replace string

    14
    0 Votes
    14 Posts
    754 Views
    astrosofistaA

    @Paolo-Serpi, @Alan-Kilborn

    I see. Let’s make sure that the Python plugin is correctly installed. I suppose you installed it with the Plugins > Plugins Admin... menu.

    Now we are going to see if it is working properly. Please click Plugins > Python Script > Show Console. On the bottom of the console there is a text box, please type in the following code

    notepad.new()

    and press Run. A new document should be opened. Got it?

    If it worked, check again Preferences > Editing > Multi-Editing Settings > Enable (Ctrl+Mouse click/selection).

    Try once more time to run the Python script, as described in previous posts.

    Other than these ones, I am running out of ideas.