"Set run action" for Wine .exe programs

Booting, installing, newbie
Message
Author
User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

"Set run action" for Wine .exe programs

#1 Post by davids45 »

G'day,

I'm running wine 1.1.19 quite happily in Puppy 4.2 SMP (full install).
In Rox, the data files for most Windows programs appear as gear-wheel icons. There is no differentiation based on the extension.

To explain my problem, I right-click on a particular gear-wheel file with the extension .ocd which happens to contain data for a map that was created by a specialised CAD program (Ocad).

Searching fhe forum :) , I learnt I needed to "Set run action" to
wine /root/.wine/drive_c/"Program Files"/Ocad8/ocad.exe & "$1"
or
wine /root/.wine/drive_c/"Program Files"/Ocad8/ocad.exe & "$@"

so that if I then clicked on a .ocd file gear-icon, Ocad would start up. It wont actually open the particular data file, just gives me a blank work-space. This is my lesser problem at the moment.

My major problem is that all the gear-wheel files are now default-set to Rox-open with Ocad regardless of their extension. So, for example, genealogy data files with a .paf extension (for a program known as Personal Ancestral File paf.exe) if clicked, open up Ocad, not PAF.

How in Rox can I differentiate the various data files for different wine-runnable programs?

David S.

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#2 Post by Béèm »

In the set run action panel you did tick the wrong box on the top.
You can choose to set for all applications or for only this type of file.

Redo the set run action for the .ocd files and change to only for this type tick box.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#3 Post by davids45 »

G'day Béèm,

Thanks for the suggestion, but I have tried both options in the top of the ROX dialog box.

Both options set by the default program path I enter as the "Set run action" will then open any the 'gear-wheel' iconified files if I click on regardless of its extension.

The simple 'wine "$@" ' as the 'action' will not activate a data file, only the main program.

Where does ROX decide what file is of what type? Can it use the final three letters of the file "name" (ie as per Windows) for this purpose?

David S.

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#4 Post by Béèm »

Yes rox uses the file name extension also. f.e. .odt is an openoffice text document. I did set the run action to swriter and when I click on a .odt file it opens in swriter.

Now I never tried it for a wine application.

I would create in /usr/share/applications a .desktop file for your wine ocad program.
As an example see the .desktop for my pegasus mail client which runs in wine.

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Name=Pegasus Mail
Icon=mini-mail.xpm
Comment=Pegasus Mail
Exec=wine "c:\program files\pmail\programs\winpm-32.exe"
Terminal=false
Type=Application
Categories=X-Internet
GenericName=Pegasus Mail

Change the values to match your ocad program and don't forget to use the back-slash not the forward-slash..
When done verify that clicking the desktop created runs the ocad program.

Now go to a .ocd file again and select set run action.
Be sure to tick for this application only.
Drag and drop the for ocad created .desktop to the set run action panel to the region 'drop a suitable program here'

Logically when clicking on a .ocd file now ocad should open and use the .ocd file.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#5 Post by technosaurus »

ROX has them in /root/Choices/MIME-types

you should make a bash script and put it there

Code: Select all

#!/bin/sh
exec wine /root/.wine/drive_c/"Program Files"/Ocad8/ocad.exe & "$@"
name the file application_ocd and change its permissions to make it executable (via right click menu)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#6 Post by Béèm »

I never understood the MIME-type thing.
In this case, by what magic, when clicking on a .ocd file is the application_ocd called? How does ROX know?
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#7 Post by technosaurus »

It looks in the specified path for MIME's that match the file type

Do you know why it looks for them?

...

.....because you can't listen for a MIME


ok that was bad... must be time to get some sleep
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Bruce B

#8 Post by Bruce B »

Béèm wrote:I never understood the MIME-type thing.
In this case, by what magic, when clicking on a .ocd file is the application_ocd called? How does ROX know?
It is not a .ocd file and the name is not arbitrary. It is a shell script. I think what technosaurus wants to achieve here is the ability to give any desktop name and particularly any icon to the script.

And if I'm wrong, technosaurus can correct the error after he wakes up.

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#9 Post by davids45 »

G'day,

Technosaurus, thanks so far, and I think a good sleep will help your problem.

When you're awake again, I have tried the MIME-types approach by copying an existing application_xxx file in the Choices/MIME-types as application_ocd and another as application_paf then editing these to find (or exec) the relevant wine executable file along the .wine path.

Clicking on the edited application_ocd icon in Choices/MIME-types opens Ocad and clicking on the application_paf opens PAF5, so I'm assuming these work (I've got the path right).

But the gear-wheel iconed data files with an .ocd and .paf extension do not respond when clicked in ROX. I tried re-booting as well as re-starting X and refreshing menus.

The "Set run action.." options from the right-click dialog box seem to be stored as similar 'application' files in /.config/rox.sourceforge.net/MIME-types, one called "application", the other "application_octet-stream". So it seems like there are only two options in the "Set run action.." menu, unless I can define my data files as something other than one of these two options?

Where in ROX is the decision to use or specify or default to the gear-wheel icon made for these various 'unknown' data file types? Normal data files such as .rtf, .txt., .doc each have a different icon and can be opened by a chosen application so presumably there is a config type file somewhere that includes what to do and what icon to use for them? I may be could then modify these to suit my data file types.

For 'fun', I'd like to create modified icons for my different data files, once I can sort out how to get them to open with their desired wine application, if that's possible.

Thanks for your time,

David S.

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#10 Post by Béèm »

Davids45,
What happens if you try my method?
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#11 Post by Béèm »

As far as I understand:
Mime stands for Multimedia Internet Mail Extension
It are indications inside an attachment/data file to indicate the type of the file.
So a text/plain inside such a file indicates the file is a plain text file.
It isn't absolutely necessary that the data file also has the extension.txt. It can be blank.
Clicking on such a file in a file manager, like rox, the file manager should analyze and detect detect the mime-type and through a mechanism give control to a script to open the corresponding program, I suppose the scripts in .../Choices/MIME-types.
In the example of text/plain the script says: defaulteditor

So I am not sure of it and hope someone can confirm or explain better for the MIME-type.

Another method is working only on the extension.
So in the case of the OP when clicking on a .ocd extension and when set run action is specified to open ocad, the ocad program should start and the .ocd file opened.

This is the way I did choose for my .odt, .ods etc.. extensions which starts the corresponding OOo program with the data file openend and I can work on the data right away.

As far as I understand, the method with MIME-type to open the ocad program with the data loaded, did fail
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#12 Post by technosaurus »

that is what I have done for other things... not sure why its not working

(it may be helpful to put your working bash script in /usr/local/bin/defaultosdviewer)

then edit /root/Choices/MIME-types/application_osd to use defaultosdviewer

the alternative is to edit /usr/local/bin/defaulthandler ... just follow the pattern

Just for curiosity can you post your bash script (including what you named it)... it could always be just a typo or something - those are the biggest pains because I never seem to notice my own typos
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#13 Post by davids45 »

G'day,
I have now created a Menu entry as per Béèm's suggestion, using the following text for my Ocad8.desktop file.

Encoding=UTF-8
Name=Ocad8
Icon=/mnt/sdb5/Puppy_Archive/Icons/WineIcons/adb7_ocad.0.xpm
Comment=Ocad map program
Exec=wine /root/.wine/drive_c/"Program Files"/Ocad8/ocad.exe & "$1"
Terminal=false
Type=Application
Categories=Graphics
GenericName=Ocad8 map drawing program

This gave me the menu entry with mini-icon under Graphic (Puppy 4.2) which opens the Ocad program if clicked.

I went to a directory containing data files with the .ocd extension and after right-clicking on one of the gear-wheel icons, and selecting "Set run action..", dragged the ocad8.desktop to the upper part of the dialog box. This box then showed this gear-wheel .ocd file was to be opened by the ocad8.desktop link. Clicking on the gear-wheel .ocd file now opened the Ocad program but not the data file itself.

But switching to a genealogy program (PAF5) directory with its .paf data files which also appear as gear-wheels, I see these are also associated with the Ocad link. Clicking on a .paf file opens Ocad.

So it still looks like I can't get ROX to differentiate these gear-wheel icon data files.

The script in my application_paf file in root/Choices/MIME-types is:

#! /bin/sh
exec wine /root/.wine/drive_c/"Program Files"/FamilySearch/Paf5/paf5.exe & "$1"

but this doesn't lead to .paf files being opened by PAF5.

Geany colours the "Program Files" part of the path orange, like the "$1" at the end - does this mean anything? And what's the difference between using $1 and $@? Clicking on the application_paf icon opens PAF5 (the program, not the data file) so it works despite the odd colours.

I'll next try technosaurus's suggestion and have a go at setting up a default_ocdviewer file in /usr/local/bin and see what happens.

Thanks again for your continued ideas.

David S.

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

set run action for wine windows programs data

#14 Post by mcewanw »

I think this is what you want:

wine /root/.wine/drive_c/"Program Files"/Ocad8/ocad.exe "${1//\//\\}"

Similarly,

wine /mnt/home/ProgramFiles/IrfanView/i_view32.exe "${1//\//\\}"

[EDIT: Here is how "${1//\//\\}" works:

${string//substring/replacement}
meaning - Replace all matches of $substring with $replacement

Note that \/ is escaped / so that the shell doesn't treat the / as a special character. Similarly \\ is escaped \ so that the shell doesn't treat the \ as a special character.]

works for me with graphics files and IrfanView using wine.

[In the above case I had i_view32.exe in a directory called ProgramFiles/IrfanView on /mnt/home as shown]

In practice, on my system, using Puppy 4.3.1, in order to use wine and IrfanView for image files I altered /usr/local/bin/defaultimageviewer from:

Code: Select all

#!/bin/sh
exec viewnior "$@"
to:

Code: Select all

#!/bin/sh
exec wine /mnt/home/ProgramFiles/IrfanView/i_view32.exe "${1//\//\\}"
That way I didn't need to change any image file type run actions (just left them as: defaultimageviewer "$1" for all image file types).

Hopefully, the above scheme will also work with MIME type handling (though haven't tried yet) since the shell script

/root/Choices/MIME-types/image_[jpeg, png and so on...]

contains:

Code: Select all

#! /bin/sh
exec defaultimageviewer "$1"
Similarly, I use the windows program PDF-Xchange Viewer to read (and annotate pdf files) so I created a defaultpdfreader shell script in /usr/local/bin in a similar way to defaultimageviewer and I altered /root/Choices/MIME-types/application_pdf to:

Code: Select all

#! /bin/sh
# exec epdfview "$1" (this is what used to be there...)
exec defaultpdfreader "$1"
Note that an alternative to some of the above is probably to use winepath as described here:

http://www.murga-linux.com/puppy/viewto ... 576#246860
Last edited by mcewanw on Sun 15 Nov 2009, 06:10, edited 1 time in total.
github mcewanw

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#15 Post by Béèm »

Hello,
What version of irfanview did you install?
I tried the latest, 425 and got an error while executing.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#16 Post by mcewanw »

I'm using IrfanView version 4.00

I didn't install it over wine, I just copied the IrfanView folder over from an underlying MS windows install and use wine with Puppy Linux 4.3.1 to run it.

[In fact I can also mount the partition that holds that MS windows installation and run IrfanView 4.00 directly from its Program Files folder there (using wine on Puppy Linux)].
github mcewanw

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#17 Post by Béèm »

Thanks for the update
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#18 Post by CatDude »

Hi

It seems that technosaurus has the right idea.
technosaurus wrote:...
(it may be helpful to put your working bash script in /usr/local/bin/defaultosdviewer)

then edit /root/Choices/MIME-types/application_osd to use defaultosdviewer

the alternative is to edit /usr/local/bin/defaulthandler ... just follow the pattern
I use a windows programme called DeltaCad (via wine),
and it creates files with a .dc extension.

So using technosaurus's advice i did the following:
  • 1.
    Created: /usr/local/bin/defaultdeltacad (set as Executable)

    Code: Select all

    #!/bin/sh
    exec wine "/root/Wine/drive_c/Program Files/DeltaCad/DELTACAD.EXE" "$@"
    
    NOTE: The above path to DETACAD.EXE had to have the surrounging double quotes, or it would not work.

    2.
    Edited: /usr/local/bin/defaulthandler
    adding the following:

    Code: Select all

     dc|DC)
      /usr/local/bin/defaultdeltacad "$1"
    
    3.
    Opened a ROX-Filer window at a directory containing some .dc files.

    I then right clicked on a .dc file, and selected: Set Run Action
    see image set-run-action.jpg
    After clicking on the: Use Command button
    the following file was automatically created: /root/.config/rox.sourceforge.net/MIME-types/application_x-dc-rom
    the contents of which is:

    Code: Select all

    #! /bin/sh
    exec defaultdeltacad "$@"
    
    4.
    Opened a ROX-Filer window at a directory containing some .dc files,
    and another ROX-Filer window at the directory containing my desired icon.

    I then right clicked on a .dc file, and selected: Set Icon
    and then dragged my desired icon to where it said "Drop an icon file here"
    see image set-icon.jpg

    After "Dropping" said icon,
    the following file was automatically created: /root/.config/rox.sourceforge.net/MIME-icons/application_x-dc-rom.png
I can now click on any .dc file, and have it open in DeltaCad,
also all .dc files now display my chosen icon.
see image deltacad-files-displaying-chosen-icon.jpg

Hope this may help
CatDude
.
Attachments
set-run-action.jpg
(25.97 KiB) Downloaded 1932 times
set-icon.jpg
(18.43 KiB) Downloaded 1945 times
deltacad-files-displaying-chosen-icon.jpg
(19.35 KiB) Downloaded 2148 times
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Rox problem?

#19 Post by davids45 »

G'day CateDude,
Thank you for your detailed post - this is just about what I was after.

I've created some executables as per your Step 1, changing your "Wine" to my ".wine" in the path, and naming these executables as "run_ocdfiles", "run_docfiles", "run_rmgfiles", etc., in place of your "default..." naming style.
These work from my /usr/local/bin when mouse-clicked.

Things don't go to plan however when I try to "Set Run Action" in Rox. I'm doing this in aragon's kernel 2.6.29 Pup 42 in case that's part of my problem. I have other Pups to try to set this up in this in as well. And if it's a Rox issue, how do I check the Rox version I've got, by the way?

For my Ocad program with its .ocd data files, the two button options for the 'Set Run Option' I get from Rox are:

'application/<anything>'
'application/octet-stream'

but not the 'application/x-dc-rom (application-x-dc-rom)' or similar, as per your posted image.

I did not get the automatically generated file as per your Step 3 after trying to 'Set Run Action'. Perhaps I had done something in trying to sort this out earlier, hence the 'octet-stream' default which needs to be deleted or dis-associated?

Is there a manual way to create the desired application-association for my .ocd files? I imagine it should be something like application-x-ocd? I see many similar files in /root/Choices/MIME-types like what I expect is needed?

Thanks again for your advice,

David S.

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#20 Post by CatDude »

Hello davids45

I downloaded the trial version of OCAD 10,
but i am not able to get it to open a .ocd file.
The programme itself starts, but will not open a file using the methods we have been trying (see image cannot-open.png)

I have tried various methods, as described in my previous post, and using your file naming as well,
i also tried with both:
  • /root/Choices/MIME-types/application_ocd
    /root/Choices/MIME-types/application_x-ocd
on seperate occasions obviously.
NOTHING seems to work
davids45 wrote: And if it's a Rox issue, how do I check the Rox version I've got, by the way?
Open a console/terminal, and enter the following:

Code: Select all

rox --version
But i do not think that it's a Rox issue myself,
as what worked for my DeltaCad will not work for OCAD

As to the automatically created files at steps 3 & 4 in my previous post,
they are still created, albeit with different names:
  • /root/.config/rox.sourceforge.net/MIME-types/application_octet-stream
    /root/.config/rox.sourceforge.net/MIME-icons/application_octet-stream.png
and all .ocd files display my chosen icon,
and clicking on any of them will open OCAD but NOT the actual file.
  • EDIT:
    Not only the .ocd files are showing my icon,
    i just noticed that vmlinuz is also showing it, and has the run action as set for the .ocd files. NOT GOOD
I honestly do not know what is going on here,
is it perhaps something peculiar to OCAD files ?

Yours completley baffled
CatDude
.
Attachments
cannot-open.png
(6.71 KiB) Downloaded 2198 times
Last edited by CatDude on Sat 14 Nov 2009, 13:27, edited 1 time in total.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

Post Reply