Announcement

Collapse
No announcement yet.

Old shortcuts refuse to remove

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Old shortcuts refuse to remove

    I am having a heck of a time getting the most recent install to remove old shortcuts. They remove from the desktop without any issue, but will not remove from the start menu. I have tried using both with and without the COMMON. I have also used Cut/Paste for the program name so I don't have any typo, spacing, etc issue. It IS creating the new shortcut in the proper location. Here are the lines which are in the PreInstall section:

    Shell.DeleteShortcut(Shell.GetFolder(SHF_DESKTOP), "MyProgramName is in here version xx");
    Shell.DeleteShortcut(Shell.GetFolder(SHF_STARTMENU _COMMON), "MyProgramName is in here version xx");
    Shell.DeleteShortcut(Shell.GetFolder(SHF_STARTMENU PROGRAMS_COMMON), "MyProgramName is in here version xx");
    Shell.DeleteShortcut(Shell.GetFolder(SHF_STARTMENU ), "MyProgramName is in here version xx");
    Shell.DeleteShortcut(Shell.GetFolder(SHF_STARTMENU PROGRAMS), "MyProgramName is in here version xx");

    Also, the log is turned on but there are no listing for the DeleteShortcut. I do get at the end:

    Notice Exit setup process (Return code: 5)

    Any suggestion will be greatly appreciated.

  • #2
    Exit code 5 means "install aborted by user", so this unusual.

    How were the shortcuts created? Via Lua actions, or by selecting the Properties dialog? If the latter, which options were selected?

    Click image for larger version

Name:	image.png
Views:	141
Size:	19.9 KB
ID:	309121

    Ulrich

    Comment


    • #3
      Properties dialog.

      Click image for larger version

Name:	image.png
Views:	122
Size:	41.2 KB
ID:	309133

      Comment


      • #4
        Try this:

        Code:
        Shell.DeleteShortcut(Shell.GetFolder(SHF_STARTMENUPROGRAMS) .. SessionVar.Expand("\\%ProductName%\\"), "Billing Clerk Version 8");
        error = Application.GetLastError();
        if (error ~= 0) then
           Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
        end
        Ulrich
        Last edited by Ulrich; 08-29-2022, 09:58 AM. Reason: Removed extra space inserted by forum engine from code sample

        Comment


        • #5
          That got rid of the error 5 but still did not remove shortcuts except on the desktop.

          Comment


          • #6
            Please make sure that the argument is SHF_STARTMENUPROGRAMS … this forum engine always inserts extra spaces into code pasted. Not sure if you saw this. The error test should have shown something if you included this code.

            Ulrich

            Comment


            • #7
              yes I saw that and corrected that. I have also verified spelling, spacing, capitalization, etc. Should the log file have a specific line showing the DeleteShortcut? It is not have any problem creating the new shortcuts or deleting the desktop one.

              [08/29/2022 11:00:46] Success Setup started: C:\Programming\WinBill 9\Distribution Setup\Version 9 Maintenance Release.exe
              [08/29/2022 11:00:46] Notice Setup engine version: 9.0.3.0
              [08/29/2022 11:00:46] Notice Product: Billing Clerk, version 9.0
              [08/29/2022 11:00:46] Success Language set: Primary = 9, Secondary = 1
              [08/29/2022 11:00:46] Success Verify archive integrity
              [08/29/2022 11:00:46] Skipped Date expiration check
              [08/29/2022 11:00:46] Skipped Uses expiration check
              [08/29/2022 11:00:46] Success System requirements check
              [08/29/2022 11:00:46] Success Include script: _SUF70_Global_Functions.lua
              [08/29/2022 11:00:46] Notice Start project event: Global Functions
              [08/29/2022 11:00:46] Success Run project event: Global Functions
              [08/29/2022 11:00:46] Notice Start project event: On Startup
              [08/29/2022 11:00:46] Success Run project event: On Startup
              [08/29/2022 11:00:46] Success Display screen: Welcome to Maintenance Release Installer
              [08/29/2022 11:00:47] Notice Start project event: On Pre Install
              [08/29/2022 11:00:47] Success Run project event: On Pre Install
              [08/29/2022 11:00:47] Success Display screen: One Progress Bar (While Installing)
              [08/29/2022 11:00:47] Success Free space check on drive: C:\
              [08/29/2022 11:00:47] Success Install archive file: C:\Dillo\Billing.exe
              [08/29/2022 11:00:47] Skipped Archive file: C:\Dillo\ChilkatAx-9.5.0-win32.dll (Reason: Existing file overwrite setting)
              [08/29/2022 11:00:47] Skipped Archive file: C:\Dillo\TeamViewerQS-idc6rar7yn.exe (Reason: Existing file overwrite setting)
              [08/29/2022 11:00:47] Success Create shortcut: C:\Users\MacW7\Desktop\Billing Clerk Version 9.lnk
              [08/29/2022 11:00:47] Success Create shortcut: C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Billing Clerk Version 9.lnk
              [08/29/2022 11:00:47] Success Create shortcut: C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Direct Connect.lnk
              [08/29/2022 11:00:47] Notice Start project event: On Post Install
              [08/29/2022 11:00:47] Success Run project event: On Post Install
              [08/29/2022 11:00:47] Success Display screen: Finished Install
              [08/29/2022 11:00:48] Notice Start project event: On Shutdown
              [08/29/2022 11:00:48] Success Run project event: On Shutdown
              [08/29/2022 11:00:48] Success Delete image file: C:\Users\MacW7\AppData\Local\Temp\_ir_sf_temp_1\IR IMG1.JPG
              [08/29/2022 11:00:48] Success Delete image file: C:\Users\MacW7\AppData\Local\Temp\_ir_sf_temp_1\IR IMG2.JPG
              [08/29/2022 11:00:48] Notice Exit setup process (Return code: 0)

              Comment


              • #8
                Weird. Please Place this into the On Pre Install event script, instead of the previous attempt. Run, and share the log file.

                Code:
                local tShortcuts = File.Find(Shell.GetFolder(SHF_STARTMENUPROGRAMS) .. SessionVar.Expand("\\%ProductName%\\"), "*.lnk", false, false);
                if (tShortcuts == nil) then
                   SetupData.WriteToLogFile("Info\tNo shortcuts found in " .. Shell.GetFolder(SHF_STARTMENUPROGRAMS) .. SessionVar.Expand("\\%ProductName%\\") .. "\r\n", true);
                else
                   for i = 1, #tShortcuts do
                      File.Delete(tShortcuts[i], false, false, true);
                      error = Application.GetLastError();
                      if (error ~= 0) then
                         SetupData.WriteToLogFile("Error\tCould not delete file " .. tShortcuts[i] .. "\r\n", true);
                      else
                         SetupData.WriteToLogFile("Info\tDeleted shortcut " .. tShortcuts[i] .. "\r\n", true);
                      end
                   end
                end

                Ulrich

                Comment


                • #9
                  I had tried moving some delete to the post install just to see if it mad any difference. I got rid of those and inserted your above. Here is the log.

                  [08/29/2022 11:58:53] Success Setup started: C:\Programming\WinBill 9\Distribution Setup\Version 9 Maintenance Release.exe
                  [08/29/2022 11:58:53] Notice Setup engine version: 9.0.3.0
                  [08/29/2022 11:58:53] Notice Product: Billing Clerk, version 9.0
                  [08/29/2022 11:58:53] Success Language set: Primary = 9, Secondary = 1
                  [08/29/2022 11:58:53] Success Verify archive integrity
                  [08/29/2022 11:58:53] Skipped Date expiration check
                  [08/29/2022 11:58:53] Skipped Uses expiration check
                  [08/29/2022 11:58:53] Success System requirements check
                  [08/29/2022 11:58:53] Success Include script: _SUF70_Global_Functions.lua
                  [08/29/2022 11:58:53] Notice Start project event: Global Functions
                  [08/29/2022 11:58:53] Success Run project event: Global Functions
                  [08/29/2022 11:58:53] Notice Start project event: On Startup
                  [08/29/2022 11:58:53] Success Run project event: On Startup
                  [08/29/2022 11:58:53] Success Display screen: Welcome to Maintenance Release Installer
                  [08/29/2022 11:58:55] Notice Start project event: On Pre Install
                  [08/29/2022 11:58:55] Info Deleted shortcut C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Billing Clerk Version 9.lnk
                  [08/29/2022 11:58:55] Info Deleted shortcut C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Direct Connect.lnk
                  [08/29/2022 11:58:55] Success Run project event: On Pre Install
                  [08/29/2022 11:58:55] Success Display screen: One Progress Bar (While Installing)
                  [08/29/2022 11:58:55] Success Free space check on drive: C:\
                  [08/29/2022 11:58:55] Success Install archive file: C:\Dillo\Billing.exe
                  [08/29/2022 11:58:55] Skipped Archive file: C:\Dillo\ChilkatAx-9.5.0-win32.dll (Reason: Existing file overwrite setting)
                  [08/29/2022 11:58:55] Skipped Archive file: C:\Dillo\TeamViewerQS-idc6rar7yn.exe (Reason: Existing file overwrite setting)
                  [08/29/2022 11:58:55] Success Create shortcut: C:\Users\MacW7\Desktop\Billing Clerk Version 9.lnk
                  [08/29/2022 11:58:55] Success Create shortcut: C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Billing Clerk Version 9.lnk
                  [08/29/2022 11:58:55] Success Create shortcut: C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Direct Connect.lnk
                  [08/29/2022 11:58:55] Notice Start project event: On Post Install
                  [08/29/2022 11:58:55] Success Run project event: On Post Install
                  [08/29/2022 11:58:55] Success Display screen: Finished Install
                  [08/29/2022 11:58:56] Notice Start project event: On Shutdown
                  [08/29/2022 11:58:56] Success Run project event: On Shutdown
                  [08/29/2022 11:58:56] Success Delete image file: C:\Users\MacW7\AppData\Local\Temp\_ir_sf_temp_1\IR IMG1.JPG
                  [08/29/2022 11:58:56] Success Delete image file: C:\Users\MacW7\AppData\Local\Temp\_ir_sf_temp_1\IR IMG2.JPG
                  [08/29/2022 11:58:56] Notice Exit setup process (Return code: 0)

                  Here is a shot of the shortcut screen just so you can see it. Once I get it to delete the version 8 then I can apply it to the others. Untilmately I only want the ver 9 and "Direct Connect" ones left.

                  Click image for larger version

Name:	image.png
Views:	110
Size:	56.1 KB
ID:	309145
                  Attached Files

                  Comment


                  • #10
                    The log shows that only "version 9" shortcuts were found in "Start Menu > AppFolder", so these versions 7 and 8 appear to have been created somewhere else.
                    Please open the Start Menu, and navigate to the "Billing Clerk" folder.
                    Right-click the "version 7" shortcut, and select Properties.
                    On the Properties dialog, go to the General tab.
                    Copy the FULL path information of the "Location" of the shortcut, and report it in your reply.
                    Repeat the same for the other shortcuts to be removed (version 8, and Teamviewer apps).

                    Click image for larger version

Name:	image.png
Views:	229
Size:	25.4 KB
ID:	309147

                    Let's get the info where these shortcuts were actually created, so they are removed as expected.

                    Ulrich

                    Comment


                    • #11
                      They are all here:

                      C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Billing Clerk

                      Comment


                      • #12
                        Okay, please complete the previous script as follows:

                        Code:
                        local tShortcuts = File.Find(Shell.GetFolder(SHF_STARTMENUPROGRAMS) .. SessionVar.Expand("\\%ProductName%\\"), "*.lnk", false, false);
                        if (tShortcuts == nil) then
                            SetupData.WriteToLogFile("Info\tNo shortcuts found in " .. Shell.GetFolder(SHF_STARTMENUPROGRAMS) .. SessionVar.Expand("\\%ProductName%\\") .. "\r\n", true);
                        else
                            for i = 1, #tShortcuts do
                                File.Delete(tShortcuts[i], false, false, true);
                                error = Application.GetLastError();
                                if (error ~= 0) then
                                    SetupData.WriteToLogFile("Error\tCould not delete file " .. tShortcuts[i] .. "\r\n", true);
                                else
                                    SetupData.WriteToLogFile("Info\tDeleted shortcut " .. tShortcuts[i] .. "\r\n", true);
                                end
                            end
                        end
                        tShortcuts = File.Find(Shell.GetFolder(SHF_STARTMENUPROGRAMS_COMMON) .. SessionVar.Expand("\\%ProductName%\\"), "*.lnk", false, false);
                        if (tShortcuts == nil) then
                            SetupData.WriteToLogFile("Info\tNo shortcuts found in " .. Shell.GetFolder(SHF_STARTMENUPROGRAMS_COMMON) .. SessionVar.Expand("\\%ProductName%\\") .. "\r\n", true);
                        else
                            for i = 1, #tShortcuts do
                                File.Delete(tShortcuts[i], false, false, true);
                                error = Application.GetLastError();
                                if (error ~= 0) then
                                    SetupData.WriteToLogFile("Error\tCould not delete file " .. tShortcuts[i] .. "\r\n", true);
                                else
                                    SetupData.WriteToLogFile("Info\tDeleted shortcut " .. tShortcuts[i] .. "\r\n", true);
                                end
                            end
                        end
                        With this in place, run it, and show the log... hopefully we now have the expected results. 🙂

                        Ulrich

                        Comment


                        • #13
                          Yes, IT MAGIC...........Your my hero for the day. I would never have gotten that. What language is that in?

                          [08/29/2022 14:34:38] Success Setup started: C:\Programming\WinBill 9\Distribution Setup\Version 9 Maintenance Release.exe
                          [08/29/2022 14:34:38] Notice Setup engine version: 9.0.3.0
                          [08/29/2022 14:34:38] Notice Product: Billing Clerk, version 9.0
                          [08/29/2022 14:34:38] Success Language set: Primary = 9, Secondary = 1
                          [08/29/2022 14:34:38] Success Verify archive integrity
                          [08/29/2022 14:34:38] Skipped Date expiration check
                          [08/29/2022 14:34:38] Skipped Uses expiration check
                          [08/29/2022 14:34:38] Success System requirements check
                          [08/29/2022 14:34:38] Success Include script: _SUF70_Global_Functions.lua
                          [08/29/2022 14:34:38] Notice Start project event: Global Functions
                          [08/29/2022 14:34:38] Success Run project event: Global Functions
                          [08/29/2022 14:34:38] Notice Start project event: On Startup
                          [08/29/2022 14:34:38] Success Run project event: On Startup
                          [08/29/2022 14:34:38] Success Display screen: Welcome to Maintenance Release Installer
                          [08/29/2022 14:34:39] Notice Start project event: On Pre Install
                          [08/29/2022 14:34:39] Info Deleted shortcut C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Billing Clerk Version 9.lnk
                          [08/29/2022 14:34:39] Info Deleted shortcut C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Direct Connect.lnk
                          [08/29/2022 14:34:39] Info Deleted shortcut C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Billing Clerk\Billing Clerk Version 7.lnk
                          [08/29/2022 14:34:39] Info Deleted shortcut C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Billing Clerk\Billing Clerk Version 8.lnk
                          [08/29/2022 14:34:39] Info Deleted shortcut C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Billing Clerk\DirectConnect.lnk
                          [08/29/2022 14:34:39] Info Deleted shortcut C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Billing Clerk\TeamViewer QS.lnk
                          [08/29/2022 14:34:39] Success Run project event: On Pre Install
                          [08/29/2022 14:34:39] Success Display screen: One Progress Bar (While Installing)
                          [08/29/2022 14:34:39] Success Free space check on drive: C:\
                          [08/29/2022 14:34:39] Success Install archive file: C:\Dillo\Billing.exe
                          [08/29/2022 14:34:39] Skipped Archive file: C:\Dillo\ChilkatAx-9.5.0-win32.dll (Reason: Existing file overwrite setting)
                          [08/29/2022 14:34:39] Skipped Archive file: C:\Dillo\TeamViewerQS-idc6rar7yn.exe (Reason: Existing file overwrite setting)
                          [08/29/2022 14:34:39] Success Create shortcut: C:\Users\MacW7\Desktop\Billing Clerk Version 9.lnk
                          [08/29/2022 14:34:39] Success Create shortcut: C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Billing Clerk Version 9.lnk
                          [08/29/2022 14:34:39] Success Create shortcut: C:\Users\MacW7\AppData\Roaming\Microsoft\Windows\S tart Menu\Programs\Billing Clerk\Direct Connect.lnk
                          [08/29/2022 14:34:40] Notice Start project event: On Post Install
                          [08/29/2022 14:34:40] Success Run project event: On Post Install
                          [08/29/2022 14:34:40] Success Display screen: Finished Install
                          [08/29/2022 14:34:41] Notice Start project event: On Shutdown
                          [08/29/2022 14:34:41] Success Run project event: On Shutdown
                          [08/29/2022 14:34:41] Success Delete image file: C:\Users\MacW7\AppData\Local\Temp\_ir_sf_temp_1\IR IMG1.JPG
                          [08/29/2022 14:34:41] Success Delete image file: C:\Users\MacW7\AppData\Local\Temp\_ir_sf_temp_1\IR IMG2.JPG
                          [08/29/2022 14:34:41] Notice Exit setup process (Return code: 0)

                          Comment


                          • #14
                            Great to hear that it worked. It is just the Lua scripting supported by Setup Factory doing it all.

                            Ulrich

                            Comment


                            • #15
                              One last question. As you can see my session variables, the program name is The Billing Clerk, but I want the shortcut folder to just be Billing Clerk so it sorts higher in the list. So where you have the %ProductName% I would just substitute %AppShortcutFolderName%

                              Click image for larger version

Name:	image.png
Views:	127
Size:	45.5 KB
ID:	309169

                              Comment

                              Working...
                              X