"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

#21 Post by davids45 »

G'day CatDude,

Thank you again for your trouble with this problem.

I have an earlier version of Ocad (Ocad8) so maybe Ocad10 is particularly difficult being the latest Windows ware.

I wondered if the "octet-stream" default is something to do with the .ocd extension being already allocated in some way, or are the "Permissions" important and the default for the .ocd format is wrong so needs to be re-set before the file will open with Wine-Ocad?

I think I'll try to use your 4-step method with a different Wine-Windows program and see if that works, meaning there is a particular issue with the Ocad program and its data files used this way. Ocad (in wine) has been very good when starting up the program then opening a file from the <File> menu.

I'll let you know what happens.

David S.
.

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

#22 Post by CatDude »

Hello davids45

Please see my EDIT:
in my previous post.

CatDude
.
[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

#23 Post by davids45 »

G'day CateDude,

Yes, I see from your Edit, you now have the problem I have, that I cannot just select with 'Set Run Action' to open any .odc file with Ocad, but all gear-wheel iconified files (presumably these are all octet-stream applications) are given the Ocad default.

G'day mcewanw,
Apologies for missing your recent post on my problem - extrapolating from your information, I have created new image_ocd and image-x_ocd executables in /root/Choices/MIME-types which if clicked in Rox will open the Ocad program. But clicking on a data .ocd file in Rox does nothing so far (I have not re-booted - are these likely to be start-up only changes?).

I have not used your string of slashes after the "$" as the "@" seems to work in opening the program for me. Could you expand on the meaning of these slashes?

Reading your conversation with Béèm, I think you are re-assigning an existing set of file types (standard image files) - changing a default viewer.

I think what I want to do is to introduce to Rox (or Puppy) a completely new file type (identified by its .ocd extension), and then open these files using the:

"exec wine "/root/.wine/drive_c/Program Files/OCad8/ocad.exe" "$@"

script in something like its own MIME-type application definition file, not the Rox-default 'application/octet-stream' which causes errors in lots of other files marked by gear-wheel icons by ROX.

I had a quick try to set the run action for an .ocd file with MuppyFiler and Worker (two other file manager programs on this Pup) but I was not successful in getting these to open by clicking on any .ocd file either (ie same as ROX). Worker reported the .ocd files as 'unidentified types' - so how can I 'identify' these files as the type I need to?

David S.

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

"$1" won't do... You need ${1//\//\\}

#24 Post by mcewanw »

davids45 wrote: I have not used your string of slashes after the "$" as the "@" seems to work in opening the program for me. Could you expand on the meaning of these slashes?
Pity you didn't try the string of slashes; without them only the program itself opens (without the data file). The slashes are there because wine needs MS windows type paths I believe (so the sed-like regular expression string of slashes swaps / for \; I think! but haven't done any bash stuff for ages so can't be sure without looking it up...). Unfortunately, I wrote the required slash sequence down in my notebook a long time ago, having come across their use in another post somewhere back then, but I can't remember the post where I first came across it and haven't found it in a quick search (might have been another forum?).

You may well be after something else, or at least extra, but as far as getting the program data to open and not just the program when you click on the data icon I definitely find that the slashes I gave are absolutely required. [ i.e. "$1" only is not enough - that just results in the program alone opening... You need: "${1//\//\\}"]

EDIT: Ah... 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.

From: http://tldp.org/LDP/abs/html/refcards.html#AEN21678
github mcewanw

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

#25 Post by davids45 »

G'day again,

I have now tried the slash combination in mcewanw's above post, by copying from the post and pasting the ${1//\//\\} over the $@ and $1 in my various MIME-type application files.

Unfortunately, then clicking on a data .ocd file, all I can get is the opening of the Ocad program with the last opened file re-opening.
The clicked-on .ocd file does not open automatically. I've tried this using ROX, MuppyFiler, Worker and X-File Explorer to navigate to a .ocd file, with the same result.

Have I missed something important?

Frustratingly, I can get the result I want (the clicked-on .ocd data file opens with the program) if I use Wine File (Windows file-manager under Wine). But I have got quite used to using ROX, so am still hoping for some magic from somewhere.

David S.

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

MIME globs file and maybe use "${@//\//\\}"

#26 Post by mcewanw »

davids45 wrote:I have now tried the slash combination in mcewanw's above post, by copying from the post and pasting the ${1//\//\\} over the $@ and $1 in my various MIME-type application files.

Unfortunately, then clicking on a data .ocd file, all I can get is the opening of the Ocad program with the last opened file re-opening.
The clicked-on .ocd file does not open automatically. I've tried this using ROX, MuppyFiler, Worker and X-File Explorer to navigate to a .ocd file, with the same result.

Have I missed something important?
@davids45:

Okay, to recap (using a different example):

In my /usr/local/bin there are various defaulthandlers (e.g. defaultspreadsheet)

For my defaultspreadsheet script I now have:

Code: Select all

#!/bin/sh
exec wine /mnt/home/ProgramFiles/AshampooOffice2008/PlanMaker.exe "${@//\//\\}"
Planmaker is the spreadsheet from softmaker office, which I run using wine. It uses the extension .pmd

I similarly have a defaultpresentations script (for powerpoint-like softmaker office files.

Code: Select all

#!/bin/sh
exec wine /mnt/home/ProgramFiles/AshampooOffice2008/Presentations.exe "${@//\//\\}"
Presentations uses the extension .prd

By default, Puppy recognises both .pmd and .prd files as the MIME type:
application/x-ole-storage

The problem with that is that if I assign a Run type to either .pmd then the .prd files will be automatically forced to run by exactly the same application (which is not what I want).

What I need is for the .pmd to be recognised as a different MIME type to the .prd

I have no idea about how to do that really, but what I experimentally did was add the following two lines to the end of the text file /usr/share/mime/globs

[Disclaimer: Any modifications you make are at your own risk!]

Code: Select all

application/x-pmd:*.pmd
application/x-prd:*.prd
Make sure the globs file ends with a single carriage return!

Then I created the following two executable shell scripts in /root/Choices/MIME-types:

The first script I called application_x-pmd
which contained:

Code: Select all

#!/bin/sh
exec defaultspreadsheet "$1"
The second script I called application_x-prd
which contained:

application_x-prd

Code: Select all

#!/bin/sh
exec defaultpresentations "$1"
That worked for me. Now any file with the extension .pmd is recognised as having MIME type application/x-pmd and any file with extension .prd is recognised as having MIME type application/x-prd.
[Right clicking on the file icon and selecting Properties shows you the mime type the file is being recognised as].

The appropriate application is thus opened on clicking either type of file icon.

I believe you need to do something similar for your .paf and .ocd file types.

Note that I didn't need to set a default Run Action after doing the above; fixing the mime type information was enough. i.e DO NOT right click on the file icon in order to forcibly enter a shell command for the file type; instead leave everything up to the mime type.

Note also that you may need to close the ROX window and reopen it before clicking on the app icon after doing all the above; I can't remember. I certainly did not need to reboot though.

Disclaimer: I really know nothing about MIME editing. I just noticed that BarryK had edited the globs file for his own purposes (even though the file header suggested it should not be manually edited) - I thus tried likewise...

My idea of modifying the globs file arose from my reading this extract from

http://roscidus.com/desktop/taxonomy/term/16
File types and icons
Category:

* MIME types
* Theming

How does the filer decide what icon to show for a file, and which program to use to open it?

For each file, the filer starts by working out its MIME-Type, as follows:

* If the file's user.mime_type extended attribute it set, then that is its MIME type.
* If the file's name matches a pattern in one of the globs file (usually, /usr/share/mime/globs) then the line in that file gives the type.
* If the contents of the file match a pattern in one of the magic files (usually, /usr/share/mime/magic) then that gives the type.
github mcewanw

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

#27 Post by davids45 »

G'day mcewanw,
Thanks for finding out how this is done. Globs seems the file to edit to define a data file by its extension, despite the BK warning.

And thanks for the link to the Rox site. Excellent!

Creating the specific application_x now means I can use an icon for all files of the particular application without other file types also getting iconified incorrectly. The upper button option of the "Set Icon" right-click menu shows the new application type. Magic!

I've also modified some existing globs entries so .doc and .xls files open in my wine MS Office, as well as adding some other new Windows specific program types.

I've found your method works quickly and well with a couple of Pups (so far - I've plenty more to modify as I pick to boot up with them).

But I'm now thinking of how I can modify my personal wine+programs pet and sfs files? I find it very simple to create a single Pet of the latest wine, including all my fonts links, and my particular Windows programs and just install that into each Pup. I also convert this Pet into sfs files for the Frugals' home directories.

How can the extra lines for these 'unusual' applications can be added to each new Pup's default globs file - adding the extra application_x files into /root/Choices/MIME-types directory is OK, but with globs, it is modifying not replacing an existing file. Or is just replacing a new Pup's globs file with my modified globs going to be OK as the data in the globs file is not changing from Pup to Pup? I suppose I should just try it for starters?

Is it worth suggesting a "How to add a new MIME-type (file extension type) in Puppy" for the "How To" section of the forum? Probably should mention the "Set run action" situation as well because that's what I first thought I had to do, but couldn't.

Thanks again for your sleuthing,

David S.

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

adding new mime types

#28 Post by mcewanw »

davids45 wrote: Is it worth suggesting a "How to add a new MIME-type (file extension type) in Puppy" for the "How To" section of the forum? Probably should mention the "Set run action" situation as well because that's what I first thought I had to do, but couldn't.
Done. http://www.murga-linux.com/puppy/viewto ... 990#363990
github mcewanw

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

modifying globs entries

#29 Post by mcewanw »

davids45 wrote: I've also modified some existing globs entries so .doc and .xls files open in my wine MS Office, as well as adding some other new Windows specific program types.
Of course you could also leave the, for example, .xls glob entry as it is and instead modify the ~/Choices/MIME-types/application_vnd.ms-excel shell script to execute a different application (than the defaultspreadsheet).

I expect the use of a common globs file may work. Alternatively, you could use a simple shell script to append a fixed set of new entries to the end of any glob file, using, for example:

Code: Select all

cat file_containing_new_glob_entries >> /usr/share/mime/globs
Always good to make a backup of the original globs file first of course! ;-)

Not so easy to modify existing entries automatically of course (nor to check what is already in a particular globs file), and you probably want to avoid modifying existing globs entries as much as possible anyway (and instead modify the scripts in ~/Choices/MIME-types to point to/exec different applications).
github mcewanw

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

#30 Post by davids45 »

G'day mcewanw,

Thank you for the rapid 'How To". I trust it will help others who want to run esoteric software with unusual extensions and still be able to click open a file.

As you mention my doctoring of existing globs entries for the standard .doc and .xls files, I'm now having a problem with these (Office 97 versions) and do need to try something different from simply editing the .doc and .xls line. Maybe that's what the warning DO NOT EDIT is all about? I should RTFW - read the first warning?? Word & Excel are complaining about not being able to find the data file I click on from Rox.

I find MuppyFiler works as well as Rox with the newly defined MIME-types but xfe (X-Filer) and Worker do not. Presumably other Puppy file managers have different means of determining file associations?

Anyway, despite the predicted heat here (41C in November), I'll first try your above suggestion as I have plenty of Pup CDs to recover a globs file from if I need to. And then see how I can improve my wine Pet and sfs to incorporate the new MIME-types.

Thanks,

David S.

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

#31 Post by davids45 »

G'day again,

Well that didn't take long.

And mcewanw, have you been taking lessons from my wife on how to hide my socks by putting them in front of me in my sock drawer?
When I actually read all of your earlier post about using the slashes but with a "@" in place of the first suggested "1", by using this slash combination in the application_x files for Word & Excel, all is now fast and fine.

So "${@//\//\\}" works with the MS Office programs data files clicked from ROX.

F'rinstance, in /root/Choices/MIME-types/, my specially created file application_x-xls reads:

#!/bin/sh
exec wine "/root/.wine/drive_c/Program Files/Microsoft Office/Office/EXCEL.EXE" "${@//\//\\}"

And now opens any .xls file I click from ROX. In dpup482beta (I'm using this now), I have not altered the /root/Choices/MIME-types/application_vnd-ms.excel but I have changed the globs entry to go to my applications_x-xls file, not to application_vnd-ms.excel

I first got this working in Pup4.2 a few minutes ago, where I had left the globs alone and just edited the application_vnd-ms.excel file with the above wine line using "${@//\//\\}".

So it looks like there are two ways to finally skin this particular cat.

David S.

Post Reply