PDA

View Full Version : Is there any common interface for running applications with arguments?



Arsham
22nd May 2011, 02:19
Hello,
I want to start an application with QProcess with some files as arguments.
As every application has it's own parameters, I was wondering if there is a common interface which can be used to ease the pain?
k3b runs like this :

k3b --data file1 file2 file3
and file-roller has this :

file-roller -d file1 file2 file3

Thank you.

DanH
22nd May 2011, 02:29
It's up to applications to parse their own parameters -- a major deficiency of both *nix and DOS/Windows, IMO (And Symbian copies DOS). Therefore there can be no common calling scheme (that doesn't require the calling programmer to know, eg, whether to insert one '-' or two).

Arsham
22nd May 2011, 11:30
Maybe I could extract the information from what the applications registered in the system's context menu.
Any suggestions?

SixDegrees
22nd May 2011, 11:51
How much "pain" is involved in this? It typically takes only a few minutes to write a command-line processing loop, if that.

Arsham
22nd May 2011, 11:55
I am making an application which sends a bunch of files to the unknown application to work on them.
The problem is we don't know what kind of cd burner/archiver is installed, and the application could be run on windows or linux.

Thanks for the reply.

DanH
22nd May 2011, 22:38
Maybe I could extract the information from what the applications registered in the system's context menu.
Any suggestions?

You might be able to do that on some systems. Or simply use the in-built facilities of the system to "send" work to the default receiver of that work. Would of course depend a lot on the specific system you're using.

Added after 5 minutes:


I am making an application which sends a bunch of files to the unknown application to work on them.
The problem is we don't know what kind of cd burner/archiver is installed, and the application could be run on windows or linux.

Thanks for the reply.

Probably your best (simplest, most flexible, most general) bet is to allow the command line to be defined in your app, using substitution variables of some sort (eg, "&file.", "&drive.") to specify where in the command line the variable parms would be inserted. eg:

glibnix -f &file. -d &drive. -write-upside-down