Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to Run a batch file from inside a QML file.
Forum Updated to NodeBB v4.3 + New Features

How to Run a batch file from inside a QML file.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 380 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.
  • M Offline
    M Offline
    mbatra
    wrote on 23 Oct 2024, 10:38 last edited by
    #1

    Hi All,

    I have created a QML application. I want to run a batch file from inside a QML file on click of a button.
    How to implement the logic.

    Any help would be appreciated.

    Thanks.

    J 1 Reply Last reply 23 Oct 2024, 12:34
    0
    • M mbatra
      23 Oct 2024, 10:38

      Hi All,

      I have created a QML application. I want to run a batch file from inside a QML file on click of a button.
      How to implement the logic.

      Any help would be appreciated.

      Thanks.

      J Offline
      J Offline
      JoeCFD
      wrote on 23 Oct 2024, 12:34 last edited by
      #2

      @mbatra QML supports Java Script.
      Try here

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GrecKo
        Qt Champions 2018
        wrote on 23 Oct 2024, 12:50 last edited by
        #3

        @JoeCFD JavaScript has no standard way to run an external executable though.

        @mbatra Expose a C++ type with an invokable function that runs your script by using QProcess.
        https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html

        J M 2 Replies Last reply 23 Oct 2024, 13:03
        4
        • G GrecKo
          23 Oct 2024, 12:50

          @JoeCFD JavaScript has no standard way to run an external executable though.

          @mbatra Expose a C++ type with an invokable function that runs your script by using QProcess.
          https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html

          J Offline
          J Offline
          JoeCFD
          wrote on 23 Oct 2024, 13:03 last edited by
          #4

          @GrecKo True. My link seems to use Node.js which QML does not support. QProcess is the way to go.

          M 1 Reply Last reply 24 Oct 2024, 10:59
          0
          • G GrecKo
            23 Oct 2024, 12:50

            @JoeCFD JavaScript has no standard way to run an external executable though.

            @mbatra Expose a C++ type with an invokable function that runs your script by using QProcess.
            https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html

            M Offline
            M Offline
            mbatra
            wrote on 24 Oct 2024, 10:58 last edited by
            #5

            @GrecKo

            Hi,

            Thanks for your support. I will try the same way as you have mentioned.
            I will post the code here if I face any issue.

            Thanks..!!

            1 Reply Last reply
            0
            • J JoeCFD
              23 Oct 2024, 13:03

              @GrecKo True. My link seems to use Node.js which QML does not support. QProcess is the way to go.

              M Offline
              M Offline
              mbatra
              wrote on 24 Oct 2024, 10:59 last edited by
              #6

              @JoeCFD

              Hi,

              Thank you, I will try using QProcess.

              1 Reply Last reply
              0

              1/6

              23 Oct 2024, 10:38

              • Login

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