Jump to content

Parameters passed to programs by file associations


Recommended Posts

I have recently installed wine so that I can run Irfan View on my Mandy 2006. Irfan works great, but I am trying to put the program into the right click menu along with the other file associations and I cannot make it work right. I put the program name in there, and Irfan comes up just fine, but with no file opened. I know that Irfan can take a command line parameter, but I do not know how to specify that in the "Edit File Type" dialog box.

 

I see some escape sequences for other programs such as %i, %m, %c and %U. Does anybody know which of these expresses the name of the file that I right clicked on. I have googled until I am blind and crazy, and I cannot find this info.

 

Thanks

Banjo

(_)=='=~

 

 

[moved from Software by spinynorman]

Link to comment
Share on other sites

I tried %1 and it tried to read a file called "%1" and failed. Do I have to escape it somehow?

 

Banjo

(_)=='=~

 

Edit: I Googled again and found here http://docs.kde.org/stable/en/kdebase/faq/filemanager.html that %i, %m, and %c are specific switches known to KDE apps. Since Irfan is a Windows app it does not understand them. Irfan reports that those parameters send:

 

%i => -ICON

%m => -MINIICON

%c => I_VIEW32.EXE (the name of the program)

 

and Irfan does not understand them.

 

I still do not know how the file name gets reported to the app.

 

B.

Edited by banjo
Link to comment
Share on other sites

I think $1 is what you would use in scripts, eg:

 

wine irfanview $1

 

and if the script was called "launchirfan", then it would be used as:

 

launchirfan values

 

replace values with whatever you want to launch with, and $1 will take the value.

Link to comment
Share on other sites

Irfan can take a file name parameter directly, so I don't think that I need a script.

 

If I did write a script I would have to pass the file name to the script as well, so then I am left with the same question I had before, "What do I put into the File Association command line to pass the file name as an argument to the command that is being invoked?" I am beginning to suspect that it is simply built into KDE apps, and the Windows app will not ever work in that way.

 

Banjo

(_)=='=~

Link to comment
Share on other sites

How was your command before, when you used the %1 and found that %1 was used? Was it in quotes? Please post exactly what was typed, so we can help figure it out.

Link to comment
Share on other sites

I have four programs associated with the .jpg file format, Kuickshow, Showfoto, GIMP, and now IrfanView

 

When I invoke the dialog using Edit File Types and then edit the asoociations I get the following command lines for each of them:

 

kuickshow %i %m -caption "%c" %U

/usr/bin/gimp-remote-2.2

showfoto %i %m -caption "%c" %U

"/home/brian/.wine/drive_c/Program Files/IrfanView/i_view32.exe" %1

 

I need the quotes around the path to irfan because of the space in the directory name "Program Files". If I leave off the quotes it fails to find the program, i_view32.exe.

 

When I right click and invoke IrfanView on the .jpg image Irfan runs and displays a box with this in it:

 

%1: CAN'T READ FILE HEADER!

UNKNOWN FILE FORMAT!

 

When I click on the OK button, Irfan is running with no file open. (edited)

 

If I drop the %1, Irfan just runs and has no file open.

 

Is there an escape sequence in that command line field that I can use to supply the file name to IrfanView?

 

I am running KDE 3.4.2 under Madriva 2006.

 

Thanks again.

Banjo

(_)=='=~

Edited by banjo
Link to comment
Share on other sites

I would be tempted to edit this entry:

 

"/home/brian/.wine/drive_c/Program Files/IrfanView/i_view32.exe" %1

 

and use the correct wine format of:

 

wine "c:\program files\irfanview\i_view32.exe"

 

this is the preferred method of launching wine apps, because issues can be encountered when using the Linux path as you've noted already. I also noticed your line doesn't have wine at the beginning of it. Try this first, and check the menu entry works, then try adding %1 after this to get it to work. If that still fails, I'd be tempted to put %U instead of %1, to see if it works this way. The %U normally deals with passing file parameters.

Link to comment
Share on other sites

Thanks for the suggestion. I will try that when I get back to my Linux box tonight.

 

I did try %U once and it appeared to have no effect, but then I was using the Linux path to the app.

 

Banjo

(_)=='=~

Link to comment
Share on other sites

OK, keep us posted. I'm not entirely sure it will solve the problem, but it's worth a shot. I'll see if I can find some more info on the parameters for passing.

Link to comment
Share on other sites

I changed my command line for the file association to

 

wine "C:\Program Files\IrfanView\i_view32.exe"

 

and IrfanView comes up with no file loaded.

 

I added in the %1 like this

 

wine "C:\Program Files\IrfanView\i_view32.exe" %1

 

and I get the error box which says that %1 is in an unkown format. So the argument "%1" is being passed into the program, but with no substitution.

 

I tried this:

 

wine "C:\Program Files\IrfanView\i_view32.exe" %U

 

and the result is the same as with no argument at all. IrfanView just comes up with no file.

 

Banjo

(_)=='=~

Link to comment
Share on other sites

I will try that when I get back to my Linux box. I am at my day job now, and they don't do Linux (fools!) :lol2:

 

BTW, wine is working out quite well for this. I thought that I had been forced out of my fav IrfanView, and I am glad to have it back. Installing wine on Mandy 2006 was painless. I clicked "Install" and stuffed the DVD into the cupholder and then it worked. For Irfan I had to download mfc42.dll, and copy it into "C:\windows\system" but that was pretty easy too. I have tried to run Linux apps on fnWindows..... :wall: Not so easy.

 

Linux rocks!

 

Banjo

(_)=='=~

Link to comment
Share on other sites

I just tried putting the %1 inside of the quotation marks in my file association command line. When I invoked the program, the busy cursor spun for a minute or so in the kicker icon and then it just disappeared. To see what the error was, I ran the same command line in a console:

 

~>wine "C:\Program Files\IrfanView\i_view32.exe %1"
wine: cannot find 'C:\Program Files\IrfanView\i_view32.exe %1'

 

I guess that since Windows file names can have spaces in them the %1 is concatenated onto the name of the executable. Bummer.

 

Banjo

(_)=='=~

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...