Author Topic: Shell Script Help Launching Images Automatically In IrfanView (Wine)  (Read 821 times)

Offline Ray2047

  • Hero Member
  • *****
  • Posts: 1528
Just discovered IrfanView can be installed through Synaptic even though it is still a Windows program running in Wine. That is fine I have used it in Wine for years but since I now know it is in the repos  and have installed the official PCLOS version I figure I can now "legally" ask this question. :)

As it stands IrfanView will not automatically open an image file when you set it as default viewer. Just the program opens then you have to open the image file from within IrfanView. Years ago I used a script to do this in PCLOS but the script stopped working at least two or three years ago. An Internet search has turned up no solution, just the same script. I'm hoping that someone can tweak the script so when I click on an image  IrfanView automatically opens the image.  I had hopes that the script would work with the version from the repos but no luck setting default to the script. (Yes, I have set the script to executable.)

Here's the script:
Code: [Select]
#!/bin/sh
IRFANVIEW="C:\\Program Files\Irfanview\i_view32.exe"
ROOT_DRIVE="Z:\\"
for arg
do
wine "$IRFANVIEW" "${ROOT_DRIVE}$(echo "$arg" | sed 's/\//\\/g')"


« Last Edit: August 25, 2012, 04:59:39 PM by Ray2047 »
KDE 64 bit.
CPU: AMD Athlon II X2 250 Processor.
Display:  nVidia C61 [GeForce 7025 / nForce 630a.
Memory: 3Gb

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11054
  • MLUs Forever!
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #1 on: August 25, 2012, 12:16:24 PM »
the script does not appear complete .....  did you copy all of it?

Add the set -x  line to your script as below, and start the script from the terminal, copy any output into your next post ...


Quote
#!/bin/sh
set -x

IRFANVIEW="C:\\Program Files\Irfanview\i_view32.exe"
ROOT_DRIVE="Z:\\"
for arg
do
   wine "$IRFANVIEW" "${ROOT_DRIVE}$(echo "$arg" | sed 's/\//\\/g')"
done
MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Ray2047

  • Hero Member
  • *****
  • Posts: 1528
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #2 on: August 25, 2012, 01:17:47 PM »
Quote
the script does not appear complete .....  did you copy all of it?
Missed the "done". That seems to have done the trick. (Pun intended). Just tested and it is working. Thanks very much.
KDE 64 bit.
CPU: AMD Athlon II X2 250 Processor.
Display:  nVidia C61 [GeForce 7025 / nForce 630a.
Memory: 3Gb

Offline Ray2047

  • Hero Member
  • *****
  • Posts: 1528
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #3 on: August 25, 2012, 03:14:35 PM »
Well it worked till I screwed it up. I discovered it was opening an install of IrfanView I'd done without Synaptic not the one I had done with Synaptic. I removed my install and it no longer works. I know nothing about shell scripts but I can guess it is pointing wrong. I can't find the location of the Synaptic installed one though the simple command "irfanview" does work in terminal and "which" returns "$ which irfanview
/usr/bin/irfanview"

Too add the install from repos will still open but will not automatically open an image file.
« Last Edit: August 25, 2012, 03:23:04 PM by Ray2047 »
KDE 64 bit.
CPU: AMD Athlon II X2 250 Processor.
Display:  nVidia C61 [GeForce 7025 / nForce 630a.
Memory: 3Gb

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11054
  • MLUs Forever!
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #4 on: August 25, 2012, 03:22:05 PM »
Check the "drive" that is in Wine ......  sorry I do not use it so do not know if it has a 'Z' drive or some other which you should be using.


You might need to add something after the command to pick up the file ....

/usr/bin/irfanview  <here>

« Last Edit: August 25, 2012, 03:24:46 PM by Just18 »
MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Ray2047

  • Hero Member
  • *****
  • Posts: 1528
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #5 on: August 25, 2012, 03:39:53 PM »
And that is what puzzles me. There is no "Z" drive but it did work till I screwed it up. There is a drive "C" but substituting "C" for Z doesn't work.

And just to state the obvious no I can't do a new direct install of the one I deleted because the installer tells me there is a version open and to close it but there isn't one open.

My screw up. Thanks for trying.
KDE 64 bit.
CPU: AMD Athlon II X2 250 Processor.
Display:  nVidia C61 [GeForce 7025 / nForce 630a.
Memory: 3Gb

Offline Ray2047

  • Hero Member
  • *****
  • Posts: 1528
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #6 on: August 25, 2012, 03:47:11 PM »
Quote
You might need to add something after the command to pick up the file
You mean something like
Code: [Select]
#!/bin/sh
set -x

IRFANVIEW="C:\\Program Files\Irfanview\i_view32.exe"
ROOT_DRIVE="Z:\\"
for arg
do
   wine "$IRFANVIEW" "${ROOT_DRIVE}$(echo "$arg" | sed 's/\//\\/g')" /usr/bin/irfanview  <here>
done
KDE 64 bit.
CPU: AMD Athlon II X2 250 Processor.
Display:  nVidia C61 [GeForce 7025 / nForce 630a.
Memory: 3Gb

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 11054
  • MLUs Forever!
Re: Shell Script Help (Re: IrfanView as Default Viewer)
« Reply #7 on: August 25, 2012, 04:16:50 PM »
Quote
You might need to add something after the command to pick up the file
You mean something like
Code: [Select]
#!/bin/sh
set -x

IRFANVIEW="C:\\Program Files\Irfanview\i_view32.exe"
ROOT_DRIVE="Z:\\"
for arg
do
   wine "$IRFANVIEW" "${ROOT_DRIVE}$(echo "$arg" | sed 's/\//\\/g')" /usr/bin/irfanview  <here>
done

No, not what I meant.
I meant when launching Irfanview that the Linux launcher might need something added after the command.

In truth, as I explained, I know nothing of WINE so that is possibly not much use.

Maybe changing the heading of this thread to include a reference to Wine might attract someone with knowledge of it  ;)   It surely ain't me  :D


regards
MLUs rule the roost!

Linux XPS 3.4.48-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT