Community
    • Login

    New 7.9.3 (x64 standard e portable) It will not start

    Scheduled Pinned Locked Moved General Discussion
    11 Posts 5 Posters 550 Views
    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.
    • dinkumoilD
      dinkumoil @Claudio Reniè
      last edited by

      @Claudio-Reniè

      Do you have installed the NppSaveAsAdmin plugin? Npp v7.9.3 crashes at startup if this plugin is installed. I already filed an issue in the plugin’s repo.

      1 Reply Last reply Reply Quote 3
      • Claudio RenièC
        Claudio Reniè
        last edited by

        Ok I confirm that was the problem (it was enough to delete this plugin from the ./plugin/ folder. Thanks.

        However, I understand that until the “Save as Admin” plugin is updated there is no possibility to save as Administrator …?

        EkopalypseE 1 Reply Last reply Reply Quote 0
        • EkopalypseE
          Ekopalypse @Claudio Reniè
          last edited by

          @Claudio-Reniè

          one option would be to run npp as administrator, but that raises other issues, such as not being able to drag and drop files from unprivileged other processes.

          1 Reply Last reply Reply Quote 2
          • Claudio RenièC
            Claudio Reniè
            last edited by

            ok. thank you all

            1 Reply Last reply Reply Quote 0
            • ChelOisC
              ChelOis
              last edited by

              Same problem here, and same solution too. :)
              Thanks for the tip.

              1 Reply Last reply Reply Quote 0
              • dinkumoilD
                dinkumoil @Claudio Reniè
                last edited by dinkumoil

                @Claudio-Reniè , @ChelOis

                There is, as there usually is, a possible workaround as long as you are willing to install a scripting plugin, in this case the NppExec plugin.

                1. Install the NppExec plugin using PluginsAdmin.
                2. After Notepad++ has restarted, paste the following code to a new document:
                Option Explicit
                
                
                'Constants declaration
                Const SW_HIDE = 0
                
                
                'Variables declaration
                Dim colArgs, objFSO
                Dim strSrcFilePath, strDstFilePath
                
                
                'Create basic objects
                Set colArgs = WScript.Arguments
                Set objFSO  = CreateObject("Scripting.FileSystemObject")
                
                
                'Not enough arguments => exit
                If colArgs.Count < 2 Then WScript.Quit 1
                
                
                'Retrieve source and destination file path from arguments
                strSrcFilePath = colArgs(0)
                strDstFilePath = colArgs(1)
                
                'Exit if
                '  - source and destination file are equal
                '  - source file doesn't exist
                '  - destination file's folder doesn't exist
                If StrComp(strSrcFilePath, strDstFilePath, vbTextCompare) = 0 Then WScript.Quit 0
                If Not objFSO.FileExists(strSrcFilePath) Then WScript.Quit 2
                If Not objFSO.FolderExists(objFSO.GetParentFolderName(strDstFilePath)) Then WScript.Quit 3
                
                
                'Script doesn't run with admin rights => Restart elevated
                If Not IsElevated Then
                  Call RestartElevated(SW_HIDE, Array(strSrcFilePath, strDstFilePath))
                End If
                
                
                'Destination file already exists => delete it
                If objFSO.FileExists(strDstFilePath) Then
                  Call objFSO.DeleteFile(strDstFilePath)
                End If
                
                'Move source file to destination
                Call objFSO.MoveFile(strSrcFilePath, strDstFilePath)
                
                
                
                
                '===============================================================================
                ' Check if script runs with elevated user rights
                '===============================================================================
                
                Function IsElevated()
                  Dim objWshShell, strKey
                
                  Set objWshShell = CreateObject("WScript.Shell")
                
                  On Error Resume Next
                  strKey = objWshShell.RegRead("HKEY_USERS\S-1-5-19\Environment\TEMP")
                
                  IsElevated = (Err.Number = 0)
                End Function
                
                
                '===============================================================================
                ' Restart script with elevated user rights
                '===============================================================================
                
                Sub RestartElevated(ByVal intShowState, ByRef arrParams)
                  Dim objFSO, arrArguments(), intCnt
                
                  Set objFSO = CreateObject("Scripting.FileSystemObject")
                
                  ReDim arrArguments(UBound(arrParams) + 2)
                
                  arrArguments(0) = "/nologo"
                  arrArguments(1) = WScript.ScriptFullName
                
                  For intCnt = 2 To UBound(arrArguments)
                    arrArguments(intCnt) = arrParams(intCnt - 2)
                  Next
                
                  Call RunElevated(WScript.FullName, objFSO.GetParentFolderName(WScript.ScriptFullName), intShowState, arrArguments)
                
                  WScript.Quit 0
                End Sub
                
                
                Sub RunElevated(ByRef strCommand, ByRef strWorkFolder, ByVal intShowState, ByRef arrParams)
                  Dim objShell
                  Dim intCnt, strArguments
                
                  Set objShell = CreateObject("Shell.Application")
                  strArguments = ""
                
                  For intCnt = 0 To UBound(arrParams)
                    strArguments = strArguments & " " & Quote(arrParams(intCnt))
                  Next
                
                  objShell.ShellExecute strCommand, strArguments, strWorkFolder, "runas", intShowState
                End Sub
                
                
                '===============================================================================
                ' Surround a string with double quotes
                '===============================================================================
                
                Function Quote(ByRef strString)
                  Quote = """" & strString & """"
                End Function
                
                1. Save the document as SaveAsAdmin.vbs to a folder where you have write permissions.
                2. In Windows Explorer, navigate to <Npp-directory>\plugins\NppExec and create a new directory SaveAsAdmin. Move the file saved in step 3. to this directory (Admin permissions required). If you prefer another location or name for this file, you have to change the script below accordingly.
                3. In Notepad++, go to (menu) Plugins -> NppExec -> Execute... and paste the following code to the dialog popping up:
                npp_console keep
                
                set local $(CurFilePath) = $(FULL_CURRENT_PATH)
                
                npe_console -- v+
                cmd.exe /c "@echo %RANDOM%"
                set local $(TempFilePath) = $(SYS.TEMP)\NppSAA_TempFile_$(OUTPUT1)_$(FILE_NAME)
                npe_console -- v-
                
                npp_saveas "$(TempFilePath)"
                npp_close
                
                cscript.exe /nologo "$(NPP_DIRECTORY)\plugins\NppExec\SaveAsAdmin\SaveAsAdmin.vbs" "$(TempFilePath)" "$(CurFilePath)"
                
                sleep 200
                npp_open "$(CurFilePath)"
                
                1. In the combobox at the lower left enter SaveAsAdmin and click the Save button.
                2. Go to (menu) Plugins -> NppExec -> Advanced Options.... Use the UI at the left hand side of the dialog to create a menu entry in Npp’s Macro menu for the script you saved in step 6.
                3. Click OK button and restart Notepad++.
                4. Go to (menu) Settings -> Shortcut Mapper... -> (register) Plugin commands and define a keyboard shortcut for the menu entry you created in step 7.

                When you want to save a file that needs admin permissions to be written, press the configured keyboard shortcut and confirm the UAC dialog popping up.

                Small flaw: The file has to be closed and reopened with Notepad++, thus its tab will be the rightmost one in tabbar.

                Çağatay KAYA 0Ç Claudio RenièC 2 Replies Last reply Reply Quote 4
                • Çağatay KAYA 0Ç
                  Çağatay KAYA 0 @dinkumoil
                  last edited by

                  @dinkumoil

                  Thank you so much, it works like a charm.

                  1 Reply Last reply Reply Quote 0
                  • Claudio RenièC
                    Claudio Reniè @dinkumoil
                    last edited by dinkumoil

                    @dinkumoil

                    WOW… Apparently it seems complicated to me but I’ll try … thanks again and let you know

                    [EDIT]
                    Lengthy quote including source code removed
                    [/EDIT]

                    dinkumoilD 1 Reply Last reply Reply Quote 0
                    • dinkumoilD
                      dinkumoil @Claudio Reniè
                      last edited by dinkumoil

                      @Claudio-Reniè

                      Meanwhile another user at GitHub figured out that plugin version 1.0.172 still works, thus you can also use this old version (have a look at Releases section of the plugin repo). AFAIK it lacks support for elevating Save as... user interaction.

                      1 Reply Last reply Reply Quote 5
                      • Claudio RenièC
                        Claudio Reniè
                        last edited by Claudio Reniè

                        I wanted to point out that here the new version compatible with notepad ++ 7.9.3 has been released (without the reported error).

                        RESOLVED

                        1 Reply Last reply Reply Quote 3
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors