HISE Logo Forum
    • Categories
    • Register
    • Login

    OS Commands

    Scheduled Pinned Locked Moved General Questions
    13 Posts 3 Posters 327 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.
    • LindonL
      Lindon @d.healey
      last edited by Lindon

      @d-healey said in OS Commands:

      @Lindon Yes that's it. File is a file object, this could be an exe or a PDF for example, the parameters is a string of parameters that you might want to pass to an executable, just like you would when running programs from the command line. If there are no parameters just use an empty string.

      OK so I've tried putting the entire string I want executing inside the file with writeString so:

      "copy c:/myfile.txt c:/users/lindon/documents/"

      and then executing .startAsProcess();

      -- this gives me an error of 0 params expecting 1

      so I tried writeString "copy" and then
      .startAsProcess(c:/myfile.txt c:/users/lindon/documents/")

      that opens the file for editing...

      So I assume I need to find the copy "file" somewhere, unless I dont understand what Im supposed to do to copy 1 file from a location a to location b.

      So next I tried creating a file for the command prompt:

      var commandPrompt = FileSystem.fromAbsolutePath("C:\Users\lindon\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools\CommandPrompt");
      

      and sending it the string I want executing:

      commandPrompt.startAsProcess("copy c:/myfile.txt c:/users/lindon/documents/")
      

      this doesnt report an error, doesnt try to start an editor, but doenst execute the command...

      HISE Development for hire.
      www.channelrobot.com

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

        There is a File.copy command already - unless Christoph hasn't merged my pull request yet

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

        LindonL 1 Reply Last reply Reply Quote 0
        • LindonL
          Lindon @d.healey
          last edited by Lindon

          @d-healey syntax?

          tried

          myFile.copy(myDestinationString)

          LoopPlayers.js (83): function not found :-(

          HISE Development for hire.
          www.channelrobot.com

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @Lindon
            last edited by Lindon

            @d-healey -- when did you make the pull request - last I can see from you was the tablelaf stuff on June 14

            Hang on found it Aug 14.... dont think its been merged...

            Link Preview Image
            Added file.move and file.copy by davidhealey 路 Pull Request #352 路 christophhart/HISE

            favicon

            GitHub (github.com)

            @Christoph-Hart any chance??

            HISE Development for hire.
            www.channelrobot.com

            Matt_SFM 2 Replies Last reply Reply Quote 1
            • Matt_SFM
              Matt_SF @Lindon
              last edited by

              @Lindon I think I've already used that function... I'll take a look when I'm back home

              Develop branch
              Win10 & VS17 / Ventura & Xcode 14. 3

              1 Reply Last reply Reply Quote 0
              • Matt_SFM
                Matt_SF @Lindon
                last edited by Matt_SF

                @Lindon Ah, the only one I used was startAsProcess. (no copy)

                const appData = FileSystem.getFolder(FileSystem.AppData);
                const manual = appData.getChildFile("MyProduct.pdf");
                
                inline function onbtnManualControl(component, value)
                {
                    if (value)
                        manual.startAsProcess("");
                };
                
                Content.getComponent("btnManual").setControlCallback(onbtnManualControl);
                

                My mistake...

                Develop branch
                Win10 & VS17 / Ventura & Xcode 14. 3

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

                  @Lindon To follow up on your commandPrompt thing.

                  When you use the copy command in the terminal you're actually running a program called copy (on MacOS and Linux it's cp).

                  So instead of getting a file object that references the command prompt program you'd want to get a reference to the copy program.

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

                  LindonL 1 Reply Last reply Reply Quote 0
                  • LindonL
                    Lindon @d.healey
                    last edited by

                    @d-healey said in OS Commands:

                    @Lindon To follow up on your commandPrompt thing.

                    When you use the copy command in the terminal you're actually running a program called copy (on MacOS and Linux it's cp).

                    So instead of getting a file object that references the command prompt program you'd want to get a reference to the copy program.

                    yes I get that - its just finding "copy.exe" on windows...馃槉

                    HISE Development for hire.
                    www.channelrobot.com

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @Lindon
                      last edited by

                      @Lindon ok found --- but not good news....

                      xcopy = FileSystem.fromAbsolutePath("C:\Windows\System32\xcopy.exe");
                      Console.print("Is file:" + xcopy.isFile());
                      

                      Tells me this is not a real file as far as HISE is concerned

                      HISE Development for hire.
                      www.channelrobot.com

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

                        @Lindon Maybe it's a permission thing. Just use my fork, or merge that pull request into your own fork.

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

                        LindonL 1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @d.healey
                          last edited by

                          @d-healey --yeah thats what im thinking I will have to do when I get to that part of the process... unless @Christoph-Hart has done the pull by then...

                          HISE Development for hire.
                          www.channelrobot.com

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

                          13

                          Online

                          1.7k

                          Users

                          11.9k

                          Topics

                          103.6k

                          Posts