Results 1 to 13 of 13

Thread: Qprocess-add commands to a running executable

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qprocess-add commands to a running executable

    The exe program is gst-player.exe from gstreamer. It supports typing like pause, play from the command line. It is for windows os. If somebody can, please provide an example using dbus/sockets/hooks

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Qprocess-add commands to a running executable

    If the program accepts commands like that from any input then I guess you can just write "pause\n" or "play\n" to std out (for the environment where your process is running).

  3. #3
    Join Date
    Sep 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qprocess-add commands to a running executable

    Can you post an example of some code for that? That would be helpful thanks. I'm not that knowledgeable at programming but I do know some and I can learn fast.

  4. #4
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qprocess-add commands to a running executable

    In that case You can write something like that:
    Qt Code:
    1. QProcess->write( "command" );
    To copy to clipboard, switch view to plain text mode 
    Of-course QProcess needs to be run at that time.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  5. #5
    Join Date
    Sep 2010
    Posts
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qprocess-add commands to a running executable

    Thanks for the code, it helped a lot. Here is a sampling of my code now.

    In my mainwindow.cpp I have:

    commandProcess.start("Path to gst-player.exe",args);

    This starts the .exe file. To input additional commands that could be typed from command prompt to control the player I use:

    commandProcess.write("pause\n");

    This pauses the media file that is playing. That line of code works with other commands that can be typed at command prompt which control the player like "continue" "stop" quit". This all happens when I click buttons on a gui I am making/experimenting now. Hope this helps others too.

Similar Threads

  1. Replies: 7
    Last Post: 13th September 2011, 13:15
  2. Replies: 0
    Last Post: 26th August 2010, 10:44
  3. Replies: 5
    Last Post: 17th March 2010, 18:30
  4. How to reload QProcess executable?
    By kommu in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 20:13
  5. Error running executable
    By Salazaar in forum Newbie
    Replies: 8
    Last Post: 21st May 2007, 06:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.