Passing arguments during OLE

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
neonjohn
Newbie
Newbie
Posts: 2
Joined: Sat Jan 24, 2009 6:40 pm

Passing arguments during OLE

Post by neonjohn »

Environment: Ubuntu 8.01, Wine 1.0.0, fresh installs.

I'm trying to get Irfanview (yes I know about the alleged clone. It isn't) to work as an "open with" program for .jpg files. I have placed it in the "open with" table When I click (gnome) on a .jpg, Irfanview opens with a blank screen. I've done some experimenting and it appears that the arguments are not being passed properly to Irfanview and/or Irfanview can't use what is being passed.

I have learned that, for example, Irfanview can be started from a shell prompt using ".\foo.jpg" as the argument but not "./foo.jpg" which is to be expected. However, Irfanview also fails when given an argument like \home\jgd\foo.jpg" and also fails when given an argument relative to drive_c such as c:\photos\foo.jpg".

Questions:
- Can I do what I want to do?
- If so what is the command line syntax that I should use?
- Short of writing a windows program, how do I find out what command line is actually being passed?

One other tidbit that might be important. The Irfanview installer would not run. I haven't had a chance to see why yet. Nothing happens on a double click to the installer. I had to install on a windows drive and copy everything over. I was pretty sure that Irfanview doesn't use the registry for anything important, as I've done the same procedure to a new windows drive and everything worked.

I know that I could probably solve the problem with a shell script but I'd like to be able to address the problem directly

thanks,
John
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Passing arguments during OLE

Post by vitamin »

neonjohn wrote:I'm trying to get Irfanview (yes I know about the alleged clone. It isn't) to work as an "open with" program for .jpg files.
You need to use winepath to translate *NIX paths into win paths: http://wiki.winehq.org/winepath
neonjohn
Newbie
Newbie
Posts: 2
Joined: Sat Jan 24, 2009 6:40 pm

Re: Passing arguments during OLE

Post by neonjohn »

[quote="vitamin"][quote="neonjohn"]I'm trying to get Irfanview (yes I know about the alleged clone. It isn't) to work as an "open with" program for .jpg files.[/quote]

You need to use winepath to translate *NIX paths into win paths: http://wiki.winehq.org/winepath[/quote]

Thanks for the tip. Now here's the solution. I had to write a shell script because apparently gnome won't execute a $() or back-tick command.

I called the script "iv" and put it in /usr/local/bin. Put the text between the dotted lines below in a file called iv (or whatever you like). Do a

$ sudo chmod +x /usr/local/bin/iv

------------------------------------------
#!/bin/bash

foo=$(winepath -w $*)
# uncomment these two lines to print diagnostics in x windows
#xmessage $* &
#xmessage $foo &

wine "/home/jgd/.wine/drive_c/Program Files/IrfanView/i_view32.exe" $foo
exit
--------------------------------------------

To associate this with a jpeg, right click on the jpg file, any file and select "propreties" When the window opens, select "Open With", click "add" and then select "use a custom command" In the command line type

/usr/local/bin/iv

Close all the windows and that's it.

the process is somewhat slow on this older 2 ghz laptop, taking about 4 seconds to open but that's OK. I would have preferred not to have to use a script but it works and that's what matters.

This script can also be used from the shell prompt to view any type of file Irfanview can open. Example

$ iv foo.jpg
$ iv /media/camera_card/dcim/foo.jpg

The latter is a typical command to view a file on a media card from a camera.

John
Locked