Community
    • Login
    1. Home
    2. Popular
    Log in to post
    • All Time
    • Day
    • Week
    • Month
    • All Topics
    • New Topics
    • Watched Topics
    • Unreplied Topics
    • All categories
    • fml2F

      Replace in Files / "Directory" field scrolls right when clicked

      Watching Ignoring Scheduled Pinned Locked Moved General Discussion
      16
      0 Votes
      16 Posts
      241 Views
      PeterJonesP

      @fml2 said in Replace in Files / "Directory" field scrolls right when clicked:

      My point exactly. This is the difference. To me, it would be more logical if no scrolling took place upon focus. Why should the field be scrolled on focus? This disrupts the mental user context IMO.

      There is no difference. You misunderstood what @Coises was trying to say: whichever combobox field you click in, that one highlights all the text and scrolls to the right; the other fields go back to their default state.

      Follow this sequence:

      STATE = nothing active/selected/focused: both Find What and Directory show the beginning of the value (“scrolled left”)
      a1f36bfd-ee45-4f68-b901-c55183d06b89-image.png STATE = click in Find What: Find What text shows the end (“scrolled right”), no change to Directory
      1a0936c3-5263-48ca-9c0d-499846b7761d-image.png STATE = click in Directory: Find What text deselects, and goes back to the beginning (“scrolled left”), and Directory selects all and shows the end (“scrolled right”)
      205ac65a-1a76-48f0-997f-90fe3dc84896-image.png STATE = click back in Find What: it goes back to the exact same thing as state 2

      They behave exactly the same: whichever one you click selects all and scrolls to the far right. There is no difference. This is standard Windows GUI behavior, and has been for at least two decades. This is not Notepad++ specific.

      update: for example, in Microsoft notepad.exe, using the Save As dialog, where the File name field uses a combobox (typeable box with pulldown arrow on right for accessing other values):

      STATE = nothing clicked/selected: the File name box is scrolled to the left, showing the beginning of the filename
      e8c1df76-cbe4-4a2a-8ff7-374f8b50b99e-image.png STATE = click in File name: it selects all and scrolls to the far right to show the end of the filename
      74fc3dd1-7ffa-4238-a410-db6d967adc02-image.png

      This is the exact same behavior as in the Notepad++ dialog box. This is standard Windows GUI behavior.

    • PeterJonesP

      Config Files Need Updating, Too

      Watching Ignoring Scheduled Pinned Locked Moved General Discussion pythonscript config-files stylers.xml langs.xml syntax highlight
      25
      9 Votes
      25 Posts
      2k Views
      PeterJonesP

      @Lycan-Thrope ,

      As I say in my reply over there, it looks like your copy is getting stuck long before it would ask to restart – it should have printed at least stylers.xml in the Status dialog. When I use my Win11 installed v8.8.1, or spin up a Win10 VM with an installed v8.8.1, it works as expected for me, so I don’t know what’s happening for you. We can continue the debug over in your Issue #2 discussion.

      If it doesn’t change anything being as it’s the latest version of NPP, shouldn’t it not shutdown after running it with no changes?

      haha, you’re funny. The “latest version of NPP” ships with themes that have many missing LexerTypes (languages) and stylers within the lexers, which is a major reason this plugin is needed. If you’ve never run the old ConfigUpdater.py or the plugin version, it’s guaranteed to make changes. (And even if you have run it before, because it does things like sort the languages, it always attempts to write all the themes, so will ask to restart even if it’s writing the same values back – someday, I might get my logic better to figure out how to compare the old-vs-new for the XML, and not ask to write if it doesn’t need to; but for now, that was the easiest to program.)

    • Dan BrownswordD

      Running Python with Notepad++ on Windows

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      6
      0 Votes
      6 Posts
      4k Views
      Neil BarrettN

      To use the anaconda prompt and have the window stay open, just put a “-i” after the path to your python installation like this:
      C:\Users\brown\anaconda3\python.exe -i “$(FULL_CURRENT_PATH)”

    • donhoD

      These were my f**king ChatGPT!

      Watching Ignoring Scheduled Pinned Locked Moved Humour
      8
      5 Votes
      8 Posts
      353 Views
      skinwalker009S

      Before I clean up, I’ll snap a pic of my “library”—three bookcases and a desk stacked with tech relics in a dim room, untouched by sunlight. It was my haven 26 years ago, my cockpit of cutting-edge gear. Now, it’s a tech museum I hope to revive. You’re right—those gadgets were our original ChatGPTs.

    • Claudia SvensonC

      How to save new (!) documents always in D:\data\ ? (And not in most recent directory)

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      10
      0 Votes
      10 Posts
      286 Views
      Alan KilbornA

      The following is TL;DR…

      A bit ago, I had a need for a “directory chooser” standard dialog to appear in one of my PythonScripts. I shared this need with the guru of all things Python (@Ekopalypse , although he will shrug off that moniker) and he graciously pursued adding code to support that in his Little Dialog Wrapper project.

      Because a directory-chooser is really just a specialized “file open” standard dialog, Eko also provided that capability – great. So now the library had file-open and dir-chooser capability. But…the glaring omission to complete the set was a “file save” standard dialog. Well…of course I nudged Eko to write that part as well, but I think he simply saw no need for it and thus didn’t do it. And so of course I said I’d do it.

      But much time passed, and I didn’t do it, because I didn’t exactly have a burning need. I already had some script code I’d developed for file-save based on some ancient code called EasyDialogs. And wow, checking out that link right now, it is really ancient (circa 2007)! This approach worked, but the type of standard dialogs generated by EasyDialogs are really “old school”.

      So then along comes this thread (the one we’re talking in right now). The OP’s need is one that can be easily scripted…IF a nice file-save dialog could be generated.

      So, I got on the proverbial horse and added the file-save dialog code to Eko’s library (in the end not a big effort, since the earlier code provided a lot of inheritable stuff). It’s been ACCEPTED and now the library offers the full complement of file-open, file-save, and directory-chooser standard dialogs.

      Ok, so here’s a (PS3) script called FileSaveReplacement.py that meets the need proposed at the start of this thread. The script is run (somewhat obviously from its name) when you’d normally save a file (i.e., hint reassign Ctrl+s to run this script). If the tab being saved exists as a file in the file system, it’s simply saved as usual. But if the tab has never been saved, a file-save dialog appears and it is based in a fixed directory (as specified in the script by the dir_for_never_saved_files variable).

      # -*- coding: utf-8 -*- ######################################### # # FileSaveReplacement (FSR) # ######################################### # note: # This script was developed and tested under Python3 64-bit on unicode (non-ANSI) encoded data. # It may work as-is using Python2 and/or ANSI-encoded data and/or 32-bits, but that would be incidental. # references: # https://community.notepad-plus-plus.org/topic/26900/how-to-save-new-documents-always-in-d-data-and-not-in-most-recent-directory # for newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript # for info on WinDialog (aka Little Dialog Wrapper), see # https://github.com/Ekopalypse/NppPythonScripts/tree/master/helper/WinDialog # https://community.notepad-plus-plus.org/topic/24389 #------------------------------------------------------------------------------- from Npp import * import os from WinDialog import * # "Little Dialog Wrapper" from WinDialog.com_dialogs import FOS #------------------------------------------------------------------------------- class FSR(object): def __init__(self): # config: dir_for_never_saved_files = r'd:\data' ext_for_never_saved_files = '.txt' # make this an empty string if the desire is to have no extension curr_filename = notepad.getCurrentFilename() if os.path.isfile(curr_filename) and ('\\' in curr_filename or '/' in curr_filename): notepad.menuCommand(MENUCOMMAND.FILE_SAVE) else: save_dlg = FileSaveDialog() save_dlg.setFolder(dir_for_never_saved_files) if '.' not in curr_filename: curr_filename += ext_for_never_saved_files save_dlg.setFileName(curr_filename) save_dlg.setFileTypes([['All files', '*.*'], ['Text Files', '*.txt']]) save_options = save_dlg.getOptions() save_options |= FOS.OVERWRITEPROMPT save_dlg.setOptions(save_options) result = save_dlg.show() if len(result) > 0: notepad.saveAs(result[0]) #------------------------------------------------------------------------------- if __name__ == '__main__': FSR()
    • DrakyemD

      Replace multiple, alternate lines in a comparison of two files

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      15
      0 Votes
      15 Posts
      235 Views
      mpheathM

      @Drakyem

      Install PythonScript 2.1 from Plugin Admin or download and install PythonScript 3. Goto menu Plugins -> Python Script -> New Script. Save with filename PokemonIntlModifier.py. Paste the PythonScript code into the saved file.

      May need to restart Notepad++ to view the file entry in the menu.

      Setup left pane as source and right pane to be modified.

      These are minimal examples to test with.

      Left pane:

      # To localize this text for a particular language, please # translate every second line of this file. [Map0] ......\wt[5] ...... ......\wt[5] ...... Hello, \PN!\nI can see you calling me over there! Hello, \PN!\nI can see you calling me over there! <INSERTED> Come over and talk to me. Come over and talk to me. [map1] \c[2]Palmiro:</c> ¡Hemos terminado! \c[2]Palmiro:</c> ¡Hemos terminado! 0 ???????? ???????? 1 Bulbasaur Bulbasaur <INSERTED> 2 Ivysaur Ivysaur ¡Felicidades! Has completado {1}. ¡Felicidades! Has completado {1}. <INSERTED>

      Added <INSERTED> to 3 lines to create differences like a language difference make it different.

      Right pane:

      # To localize this text for a particular language, please # translate every second line of this file. [Map0] ......\wt[5] ...... ......\wt[5] ...... Hello, \PN!\nI can see you calling me over there! Hello, \PN!\nI can see you calling me over there! Come over and talk to me. Come over and talk to me. [map1] \c[2]Palmiro:</c> ¡Hemos terminado! \c[2]Palmiro:</c> ¡Hemos terminado! 0 ???????? ???????? 1 Bulbasaur Bulbasaur 2 Ivysaur Ivysaur ¡Felicidades! Has completado {1}. ¡Felicidades! Has completado {1}.

      PythonScript:

      # about: Modify intl.txt extracted from the Pokemon Essentials Editor # help: https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript # name: PokemonIntlModifier # require: Notepad++ with PythonScript >= 2 plugin # src: https://community.notepad-plus-plus.org/topic/26913 # important: Left pane as source and right pane to be modified. from Npp import editor1, editor2, notepad def main(): # Set to True if 2nd line is different and should be made empty. blank_if_different = False # Do not modify these lines. line_count = editor.getLineCount() line_next = True replaced = 0 editor2.beginUndoAction() # Process the buffers. for line in range(line_count): # Get lines from both editor panes. text1 = editor1.getLine(line).rstrip('\r\n') text2 = editor2.getLine(line).rstrip('\r\n') # Skip comment and section lines. if text1.startswith(('#', '[')): continue # Skip integer lines. if text1.isdigit(): continue # Allow the 2nd line only. line_next = not line_next if not line_next: continue # Replace 2nd line if different. if text1 != text2: if blank_if_different: text1 = '' editor2.replaceLine(line, text1) replaced += 1 editor2.endUndoAction() notepad.messageBox('Done {} lines'.format(replaced)) main()

      Result after running the script:

      img.png

      I enabled Change History to show in the lines and enabled End Of Lines to show to identify the affect of the modifications.

      If inspected as not OK then it can be undone with pressing Ctrl+Z on the right pane.

    • Neko_KaiohN

      Plugin/Script to clean up text noise?

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      7
      0 Votes
      7 Posts
      125 Views
      Lycan ThropeL

      @Neko_Kaioh said in Plugin/Script to clean up text noise?:

      Yeah, I used that one. Theres nothing on the file that I need to worry about, but it doesnt tell me anything I personally can use.

      "File Type: MSX Graph Saurus compressed image

      MIME Type: application/octet-stream;
      Suggested file extension(s): bin lha lzh exe class so dll img iso"

      So, if anyone reading this happens to know a program or two that I could try to view the file properly, I’d be very grateful.

      At best, you could use the Hex Editor plugin, however, from the information and this discussion so far, it is apparent that your abilities will be taxed, since you can’t tell when a file is binary or not, just by looking at it. If it’s like the file on the left that @PeterJones showed you, I noticed right away the first two letters in the file, PK, and to me that looks like a PKWare file, meaning it’s compressed at best, as matches your description of the file type that web site told you it was. That’s a compressed graphic file, meaning it’s encoded and at this point, I don’t see you having the skill set necessary to use a Hex Editor and be able to debug/decrypt a file.

      Your best bet it to use the file in an application that generated it, and you can do that on your own by using that ubiquitous tool, Google, and putting that file type in the search terms and follow all the links you can until you find a tool that you can use to open that file with so that it can be played, viewed or whatever it is that it is designed to do. As @Terry-R has suggested, we can’t help anymore than this.