Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Reduce Some Typos

    General Discussion
    2
    5
    174
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Eric Bloch
      Eric Bloch last edited by

      In the past I made typos by typing in the wrong document open for reference instead of the desired doc being modified. To reduce this I made the following batch to toggle the Windows 10 file read attribute on/off. Place batch in Windows “SendTo” folder.

      Note that NPP must be closed to change the attribute of a file open in NPP and line with START extends to 400.

      : _ReadAttribChange.bat
      :: Toggles file Attribute r on/off
      :: Use Right Click SendTo menu
      :: Up to 9 files at once
      ECHO OFF & CLS
      :: Change CMD Window title, size, and position
      :: ==================================
      TITLE .ReadAttribChange+.bat
      START “” /WAIT D:_NirSoft\multimonitortool-x64\MultiMonitorTool.exe /MoveWindow 1 Title “.ReadAttribChange+.bat” /WindowLeft 1200 /WindowTop 400
      MODE CON: COLS=11 LINES=1
      :: IF NOTEPAD RUNNING CLOSE IT
      :: ----------------------------------------------------------------
      TASKLIST | FIND “notepad++.exe” > NUL && (TASKKILL /IM “notepad++.exe” /T > NUL & SET “_Run=1”)
      TIMEOUT /T 1 > NUL
      FOR %%G IN (“%1” “%2” “%3” “%4” “%5” “%6” “%7” “%8” “%9”) DO (
      ECHO %%~aG > F:_ATTRIB.TXT
      FINDSTR “r R” F:_ATTRIB.TXT && ATTRIB -R %%G || ATTRIB +R %%G
      )
      DEL F:_ATTRIB.TXT
      :: IF NOTEPAD WAS RUNNING OPEN IT
      :: ----------------------------------------------------------------
      IF %_Run%==1 START “” “C:\Program Files\Notepad++\notepad++.exe”
      EXIT

      1 Reply Last reply Reply Quote 1
      • Alan Kilborn
        Alan Kilborn last edited by Alan Kilborn

        A variation is to just tell Notepad++ that you want it to consider your file as not changeable. A way to do this on an already open file is via this menu item:

        9e30c60f-055b-4020-8749-a59347baa55a-image.png

        A command-line way to load files so that they aren’t changeable is:

        yourNppPath\notepad.exe -ro file1.ext file2.ext

        See the -ro part? That means “read-only” opening for any files that follow it, in the example two files.

        You can make it an Explorer right-click item (on Win10, works for me at least, YMMV) by using the command-line argument idea and creating the following key and value:

        a9eecd9c-d5db-4315-8aa3-12a6b91cd864-image.png

        Obviously, you’d need to replace yourNppPath where I show it above with your own path to Notepad++.

        Note in the registry I show what I have for View with Notepad++ but I also have an Edit with Notepad++ that is similar but without the -ro command line argument.

        Eric Bloch 1 Reply Last reply Reply Quote 3
        • Eric Bloch
          Eric Bloch @Alan Kilborn last edited by

          @alan-kilborn Thanks for your reply. I had not observed the ro selection on the right click menu which is very convenient for a single file. My batch is constructed to do up to 9 files at once and I have a second batch which toggles ro and adds the selected files to NPP.

          Eric Bloch 1 Reply Last reply Reply Quote 0
          • Eric Bloch
            Eric Bloch @Eric Bloch last edited by

            @eric-bloch
            Using “ro” only effects NPP and does NOT change the Window’s attribute.

            NPP should be changed from “Read Only” to “Set Read Only Flag” to match the “Clear Read Only Flag”

            Alan Kilborn 1 Reply Last reply Reply Quote 0
            • Alan Kilborn
              Alan Kilborn @Eric Bloch last edited by

              @eric-bloch

              There is perhaps an argument for additional functionality, specifically “Set Read Only Flag”, but I wouldn’t change or remove existing functionality if it were up to me.

              THIS THREAD may interest you, as it provides a means to add in the additional functionality.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors