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.
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 3 Posters 308 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 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.

    JoeCFDJ 1 Reply Last reply
    0
    • M mbatra

      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.

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      @mbatra QML supports Java Script.
      Try here

      1 Reply Last reply
      0
      • GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on 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

        JoeCFDJ M 2 Replies Last reply
        4
        • GrecKoG GrecKo

          @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

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on 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
          0
          • GrecKoG GrecKo

            @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 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
            • JoeCFDJ JoeCFD

              @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 last edited by
              #6

              @JoeCFD

              Hi,

              Thank you, I will try using QProcess.

              1 Reply Last reply
              0

              • Login

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