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. Encountering issues while trying to start a command line process (openoffice.org) from inside Qt program
Forum Updated to NodeBB v4.3 + New Features

Encountering issues while trying to start a command line process (openoffice.org) from inside Qt program

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    cosscat
    wrote on last edited by
    #1

    Hello everyone,

    I'm trying to run a command from inside Qt. I would like to do it like fire and forget, meaning i don't need the program to wait for my process to stop, before continuing. In essence, the openoffice.org process I start applies a macro on a document used as template.
    In essence this code work perfectly in a bash shell:
    openoffice.org3 "macro:///Standard.Module1.findandreplace" template.doc
    or as
    openoffice.org3 template.doc "macro:///Standard.Module1.findandreplace"

    The trouble is that when trying to do the same from inside the Qt program (as explained in QProcess help page) it's not the same success.

    @
    ...
    QString parameter="template.doc"
    ...
    QString program = "openoffice.org3 "; // tried also with QString program = "/usr/bin/openoffice.org3 "; same results
    QStringList arguments;
    arguments <<parameter<<" "macro:///Standard.Module1.findandreplace" ";

            QProcess *myProcess = new QProcess();// tried also with ... new QProcess(this);
            myProcess->start(program, arguments);
    

    ...
    @

    Any ideas on this?; From what i understood, all you have to do is prepare the args list for the program, which in this case is the macro and the template file.

    I get no error.

    Thank you,

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      If you don't want to wait for the process to finish, use QProcess::startDetached(). Why are you adding a space after the program name?

      You can try adding the whole line (program name + arguments) to the first parameter of QProcess::start(), leaving the arguments QStringList empty. That sometimes works better.

      (Z(:^

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cosscat
        wrote on last edited by
        #3

        Hello sierdzio,

        Thank you very much for your recommendation. It was magnificent. Now I have an other issue, but this is not related to Qt.
        When Openoffice starts it gives me this error:
        "BASIC runtime error.
        Property or method not found: createReplaceDescriptor"

        It is very strange, because when I open the file manually and go to Tools -> Macros -> Run Macro and I select findandreplace it works perfectly.
        If any clues, greatly appreciated (though again is not related to Qt)

        Regards,

        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