Results 1 to 3 of 3

Thread: Mozilla/Firefox remote command

  1. #1
    Join Date
    Mar 2006
    Posts
    8
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Mozilla/Firefox remote command

    I'm trying to control Mozilla or Firefox from QProcess on Linux. I get them to start, but I can't change the URL in an already opened browser. I try the command mozilla -remote "openURL(www.qtcentre.org)" but QProcess just opens another instance of the browser. From the command line it works as it should. Anyone know the syntax for this? This is what I'm doing, it doesn't matter if I use process.start or launch.

    Qt Code:
    1. if ( !process_started ) {
    2. cout << "Web browser not running. Trying to start" << endl;
    3. args += "mozilla";
    4. args += rUrl;
    5. process.setArguments( args );
    6. QString buf;
    7. process_started = process.launch( buf );
    8. return process_started;
    9. }
    10.  
    11. if ( process_started ) {
    12. cout << "Web browser already running. Sending new address to already opened browser." << endl;
    13. args += "mozilla";
    14. args += "-remote \"openURL(" + rUrl + ")\"";
    15. process.setArguments( args );
    16. QString buf;
    17. process_started = process.launch( buf );
    18. return process_started;
    19. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Mozilla/Firefox remote command

    Lose the quotes around the openUrl command and separate "-remote" from the actual command.
    Qt Code:
    1. process.setArguments(QStringList()
    2. << "mozilla"
    3. << "-remote"
    4. << "openUrl(http://www.qtcentre.org)"
    5. );
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2006
    Posts
    8
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mozilla/Firefox remote command

    Losing the quotes did it! Thank you very much for your help.

Similar Threads

  1. call bash/terminal command with QT
    By myta212 in forum Newbie
    Replies: 1
    Last Post: 13th November 2006, 16:38
  2. Replies: 4
    Last Post: 10th November 2006, 13:07
  3. space left command?
    By mhoover in forum General Discussion
    Replies: 1
    Last Post: 27th July 2006, 04:34
  4. Passing Command Line Values?
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 29th March 2006, 09:26
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 16:52

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.