HISE Logo Forum
    • Categories
    • Register
    • Login

    File.startAsProcess

    Scheduled Pinned Locked Moved Scripting
    20 Posts 2 Posters 369 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.
    • Oli UllmannO
      Oli Ullmann
      last edited by Oli Ullmann

      Hello to all,

      how do I use File.startAsProcess()? If I give an empty string as a parameter (“”) the file is simply copied and the folder containing the file is opened. But I want it to be executed.

      @d-healey I think you had implemented the function. Do you have a tip here?

      This is my code:

      inline function installPlugIns()
      {
      	local installerApp = downloadsFolder.getChildFile(fileNames[0]);
      	installerApp.startAsProcess("");
      }
      

      Thank you very much
      Oli

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Oli Ullmann
        last edited by

        @Oli-Ullmann Does the file have execute permissions?

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        Oli UllmannO 1 Reply Last reply Reply Quote 0
        • Oli UllmannO
          Oli Ullmann @d.healey
          last edited by

          @d-healey
          I have added this to my script:

          installerApp.setExecutePermission(true);
          

          Still the same behavior...

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Oli Ullmann
            last edited by

            @Oli-Ullmann What happens when you run the file from the commandline manually (outside of HISE)

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            Oli UllmannO 1 Reply Last reply Reply Quote 0
            • Oli UllmannO
              Oli Ullmann @d.healey
              last edited by Oli Ullmann

              @d-healey
              When I use "open QUADRIUM_0_9_Beta_r0002.pkg" in the terminal it opens the application.

              When I use "open -a" it says it is unable to find application. Maybe because it is a pkg file?

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Oli Ullmann
                last edited by

                @Oli-Ullmann You have you to use open?

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                Oli UllmannO 1 Reply Last reply Reply Quote 0
                • Oli UllmannO
                  Oli Ullmann @d.healey
                  last edited by Oli Ullmann

                  @d-healey
                  If I just type "QUADRIUM_0_9_Beta_r0002.pkg" it says "command not found".
                  Maybe because it is a pkg file?
                  And if so is there a way to start/open pkg files from within HISE?

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @Oli Ullmann
                    last edited by

                    @Oli-Ullmann Seems strange, are you using a bash terminal?

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    Oli UllmannO 1 Reply Last reply Reply Quote 0
                    • Oli UllmannO
                      Oli Ullmann @d.healey
                      last edited by Oli Ullmann

                      @d-healey
                      I work on the Mac and use the build in terminal.

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Oli Ullmann
                        last edited by

                        @Oli-Ullmann But is it using bash or a different shell?

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        d.healeyD Oli UllmannO 2 Replies Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @d.healey
                          last edited by

                          Oh I have an idea, let me test something

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          1 Reply Last reply Reply Quote 1
                          • Oli UllmannO
                            Oli Ullmann @d.healey
                            last edited by

                            @d-healey
                            It says "zsh: command not found" so I guess it's not bash. But to be honest, I'm not really familiar with it.

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @Oli Ullmann
                              last edited by d.healey

                              @Oli-Ullmann Yeah I checked, on MacOS now it defaults to zsh instead of bash, but actually it seems the issue is that you must use the open command.

                              You might know this already but I'll give a little explainer just in case you don't. When you run a "command" from the terminal on any OS, most of the time that command is not actually a command but it's running a program. For example when you run cp to copy a file, you are actually running a program called cp.

                              In the present situation you are running a program called open and passing the file you want to run as a parameter.

                              So my idea is instead of trying to execute the pkg file, you instead execute open and pass the pkg as the parameter in the parenthesis.

                              To do this you'll need to get the open program into a file object. Usually these stock programs are in /usr/bin, but you can use which open to find the location if you need to.

                              Putting it together:

                              inline function installPlugIns()
                              {
                                local openCommand = FileSystem.fromAbsolutePath("/usr/bin/open");
                                openCommand.startAsProcess(fileNames[0]);
                              }
                              

                              Let me know if it works.

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              Oli UllmannO 1 Reply Last reply Reply Quote 0
                              • Oli UllmannO
                                Oli Ullmann @d.healey
                                last edited by Oli Ullmann

                                @d-healey
                                Unfortunately, that doesn't work yet either. I have checked with “which open” where the open program is located and it is also located at the path you specified.

                                I have also tried this variant, but it still does not work.

                                inline function installPlugIns()
                                {
                                  local installerApp = downloadsFolder.getChildFile(fileNames[0]);
                                  local openCommand = FileSystem.fromAbsolutePath("/usr/bin/open");
                                  openCommand.startAsProcess(installerApp.toString(0));
                                }
                                

                                I also used if(openCommand.isFile()) to check whether the file really exists.

                                d.healeyD 1 Reply Last reply Reply Quote 0
                                • d.healeyD
                                  d.healey @Oli Ullmann
                                  last edited by

                                  @Oli-Ullmann Ok, I'll fire up my Mac VM and see if I can figure it out

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  Oli UllmannO 2 Replies Last reply Reply Quote 1
                                  • Oli UllmannO
                                    Oli Ullmann @d.healey
                                    last edited by

                                    @d-healey
                                    Thank you very much David! As always, you are a great help!

                                    1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey
                                      last edited by d.healey

                                      Works here, make sure your installerApp path is correct

                                      HiseSnippet 904.3ocsUE0aaaCDlxIJXVcaXEnOsmD7SJEEV1wI1AnXXI1IdyXyoFyoEaOUPQQEyFJRARprYLz+y6eP6QIkH4lfzVCL+fgNd2GuO9w6Nt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7EmWLzxw4bAFp.KpVQeDcyfp1B
                                      

                                      Peek 2024-11-16 15-53.gif

                                      Libre Wave - Freedom respecting instruments and effects
                                      My Patreon - HISE tutorials
                                      YouTube Channel - Public HISE tutorials

                                      Oli UllmannO 2 Replies Last reply Reply Quote 1
                                      • Oli UllmannO
                                        Oli Ullmann @d.healey
                                        last edited by

                                        @d-healey

                                        I used the time to try this out in an empty project:

                                        const dlfolder = FileSystem.getFolder(FileSystem.Downloads);
                                        
                                        const f = dlfolder.getChildFile("QUADRIUM_0_9_Beta_r0002.pkg");
                                        
                                        if(f.isFile())
                                        {
                                        	f.startAsProcess("");
                                        }
                                        

                                        It works! So there must be another problem in my code.
                                        const dlfolder = FileSystem.getFolder(FileSystem.Downloads);

                                        1 Reply Last reply Reply Quote 0
                                        • Oli UllmannO
                                          Oli Ullmann @d.healey
                                          last edited by

                                          @d-healey
                                          Yes, there must be a different problem!

                                          Nevertheless, thank you very much for your help David!

                                          1 Reply Last reply Reply Quote 0
                                          • Oli UllmannO
                                            Oli Ullmann @d.healey
                                            last edited by

                                            @d-healey
                                            Stupid mistake! I was referring to the zip file in startAsProcess(“”) and not the pkg file.
                                            So the installer was not copied as I thought, but it was unpacked again.

                                            Thank you very much, David. The correspondence with you helped me to find the error.

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            19

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.4k

                                            Posts