Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Qt Installer Framework] Run a batch file during uninstallation
Forum Updated to NodeBB v4.3 + New Features

[Qt Installer Framework] Run a batch file during uninstallation

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.7k Views
  • 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.
  • A Offline
    A Offline
    akhi95
    wrote on last edited by
    #1

    Hi, is there a way to run a batch file during uninstallation of an app created using Qt Installer Framework?

    J.HilkJ 1 Reply Last reply
    0
    • J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #6

      Ok, I found the correct file.

      seems like I abandoned the shell script on deinstall and went directly to this entry

      Component.prototype.createOperations = function() {
      ...
      component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp");
      }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      A 2 Replies Last reply
      0
      • A akhi95

        Hi, is there a way to run a batch file during uninstallation of an app created using Qt Installer Framework?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #2

        @akhi95 sure

        listen to the uninstallationStarted signal, and connect a function to it. In that function call the script.

        I use it to remove desktop (shortcut) icons on MacOS

        function Component()
        {
        ...
            installer.uninstallationStarted.connect(onUninstallationStarted);
        }
        
        onUninstallationStarted = function()
        {
            var argList = ["@TargetDir@/myApp.app/Contents/MacOS/data/remove-alias.sh"];
            installer.execute("sh",argList);
        }
        

        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        A 1 Reply Last reply
        2
        • J.HilkJ J.Hilk

          @akhi95 sure

          listen to the uninstallationStarted signal, and connect a function to it. In that function call the script.

          I use it to remove desktop (shortcut) icons on MacOS

          function Component()
          {
          ...
              installer.uninstallationStarted.connect(onUninstallationStarted);
          }
          
          onUninstallationStarted = function()
          {
              var argList = ["@TargetDir@/myApp.app/Contents/MacOS/data/remove-alias.sh"];
              installer.execute("sh",argList);
          }
          
          A Offline
          A Offline
          akhi95
          wrote on last edited by
          #3

          @J-Hilk Thanks for the reply. Since an hour, I have been trying to make your code work for my batch script but I'm unable to do so. I'm doing something like this

          function Component()
          {
          ...
              installer.uninstallationStarted.connect(onUninstallationStarted);
          }
          
          onUninstallationStarted = function()
          {
              var argList = ["@TargetDir@/test.bat"];
              installer.execute("bat",argList);
          }
          
          JonBJ J.HilkJ 2 Replies Last reply
          0
          • A akhi95

            @J-Hilk Thanks for the reply. Since an hour, I have been trying to make your code work for my batch script but I'm unable to do so. I'm doing something like this

            function Component()
            {
            ...
                installer.uninstallationStarted.connect(onUninstallationStarted);
            }
            
            onUninstallationStarted = function()
            {
                var argList = ["@TargetDir@/test.bat"];
                installer.execute("bat",argList);
            }
            
            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by JonB
            #4

            @akhi95
            Sorry I'm not a "Qt Installer Framework" person, but what is your installer.execute("bat", ...;? bat is no kind of Windows command. If you need something there I would have thought it would likely be one of the following:

            var argList = ["@TargetDir@/test.bat"];
            installer.execute("cmd",argList);
            
            var argList = ["/c", "@TargetDir@/test.bat"];
            installer.execute("cmd", argList);
            
            var argList = [];
            installer.execute("@TargetDir@/test.bat", argList);
            

            ? There ought be Google examples somewhere?

            1 Reply Last reply
            3
            • A akhi95

              @J-Hilk Thanks for the reply. Since an hour, I have been trying to make your code work for my batch script but I'm unable to do so. I'm doing something like this

              function Component()
              {
              ...
                  installer.uninstallationStarted.connect(onUninstallationStarted);
              }
              
              onUninstallationStarted = function()
              {
                  var argList = ["@TargetDir@/test.bat"];
                  installer.execute("bat",argList);
              }
              
              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #5

              @akhi95
              @JonB is correct you will probably want to call the commandpropt for that batch file.

              That said, I may have given you a faulty example. I copy pasted from one I have still on my PC and I struggle to get it to work.

              But I have some google coordinates for you, that may also help:

              https://stackoverflow.com/questions/54810688/uninstall-flow-or-callback-in-qt-installer-framework-3-0-2

              I'll post again, if I manage my example to work as well, it's been over a year for me 🙈


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              A 1 Reply Last reply
              0
              • J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #6

                Ok, I found the correct file.

                seems like I abandoned the shell script on deinstall and went directly to this entry

                Component.prototype.createOperations = function() {
                ...
                component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp");
                }
                

                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                A 2 Replies Last reply
                0
                • J.HilkJ J.Hilk

                  Ok, I found the correct file.

                  seems like I abandoned the shell script on deinstall and went directly to this entry

                  Component.prototype.createOperations = function() {
                  ...
                  component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp");
                  }
                  
                  A Offline
                  A Offline
                  akhi95
                  wrote on last edited by
                  #7
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • J.HilkJ J.Hilk

                    @akhi95
                    @JonB is correct you will probably want to call the commandpropt for that batch file.

                    That said, I may have given you a faulty example. I copy pasted from one I have still on my PC and I struggle to get it to work.

                    But I have some google coordinates for you, that may also help:

                    https://stackoverflow.com/questions/54810688/uninstall-flow-or-callback-in-qt-installer-framework-3-0-2

                    I'll post again, if I manage my example to work as well, it's been over a year for me 🙈

                    A Offline
                    A Offline
                    akhi95
                    wrote on last edited by
                    #8
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • J.HilkJ J.Hilk

                      Ok, I found the correct file.

                      seems like I abandoned the shell script on deinstall and went directly to this entry

                      Component.prototype.createOperations = function() {
                      ...
                      component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp");
                      }
                      
                      A Offline
                      A Offline
                      akhi95
                      wrote on last edited by
                      #9

                      @J-Hilk said in [Qt Installer Framework] Run a batch file during uninstallation:

                      Ok, I found the correct file.

                      seems like I abandoned the shell script on deinstall and went directly to this entry

                      Component.prototype.createOperations = function() {
                      ...
                      component.addOperation("Execute","echo", "do nothing","UNDOEXECUTE","rm", "-rf", "@HomeDir@/Desktop/MyApp");
                      }
                      

                      This worked! Thanks a ton! Initially, I didn't notice the neat little trick you did by doing nothing in the Execute part.

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved