| View previous topic :: View next topic |
| Author |
Message |
PastorEd General User


Joined: 28 Sep 2004 Posts: 9 Location: the bustling metropolis of Centralia, WA
|
Posted: Sat Sep 22, 2007 11:50 am Post subject: Calling Linux Writer from within WINE program |
|
|
Hello all -
Here's an interesting problem. I have a MSWin program running with WINE. When the program needs to edit a text file, it makes a call to a word processor.
The default word processor it asks for is Word, of course. However, the option exists for the user to change to their processor of choice. I have chosen OpenOffice.org Writer.
The MSWin program sends the command, and starts oowriter2.2 just fine. What Writer cannot seem to do is correctly interpret the location of the files that need to be opened.
They are at /home/user/.wine/drive_c/Program Files/YA/Forms/desired.doc
However, when Writer tries to open them, it coughs up a dialog box telling me that it can't open them because:
"/home/user/.wine/drive_c/Program Files/YA/C:\Program Files\YA\Forms\desired.doc does not exist."
See the backslashes in there? How do I get Writer to correctly interpret those backslashes?
Any thoughts? Thanks for your help! _________________ GBYLBT... PastorEd
Registered Linux user #316504
(God Bless Your Linux Box Today) |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Sat Sep 22, 2007 2:30 pm Post subject: |
|
|
| If you just need to edit a text file, you don't want to use OOo at all. Just have it call Notepad, or Wordpad. |
|
| Back to top |
|
 |
PastorEd General User


Joined: 28 Sep 2004 Posts: 9 Location: the bustling metropolis of Centralia, WA
|
Posted: Sat Sep 22, 2007 4:25 pm Post subject: That's interesting, but... |
|
|
...since my wife needs to be able to access these files - which are not just plain text files, by the way, but fully formatted DOC files which OpenOffice can open correctly, but Notepad and Wordpad do not...
...my original question stands.
Can anyone tell me HOW to get a windows program running with WINE to tell OpenOffice Writer how to *correctly* open one of its .DOC files?
Thanks for any help anyone can provide. _________________ GBYLBT... PastorEd
Registered Linux user #316504
(God Bless Your Linux Box Today) |
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Sat Sep 22, 2007 5:12 pm Post subject: |
|
|
| Is there not a forum or mailing list supporting the use of Wine? Other Linux software must encounter the same issue - i.e. the use of back slashes instead of forward slashes. I'm fairly certain I was able to open Windows files from /mnt/windows or whatever location I used when I still needed access. (Don't even have a Windows partition on my current working machine.) |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Sat Sep 22, 2007 6:59 pm Post subject: |
|
|
Well, in that case, I think you really want to run a Windows program to deal with it. As I recall, OOo (the WIndows version I mean) runs just fine under Wine. Either install OOo under Wine, or run it from an actual Windows partition.
I'm going to take a wild guess that you don't want to do that
I really think that's going to be the most direct way to handle this, but if you are determined to find another way, you can take care of the backslash problem by interposing a script in place of OOo. The script will simply take all the arguments and replace any backslashes with forward slashes, then call the real openoffice with the modified parameters.
Such a script would look something like this:
| Code: | #!/bin/sh
for i in "$@"
do
a="$a `echo "$i"|sed -e 's!\\\!/!g'`"
done
eval ooffice $a
|
You may need to change the "ooffice" to whatever your distro names the command that starts OOo.
My guess is that this will be only the first of many issues, but maybe I'm wrong and it's worth a try.
I would agree with noranthon: this is probably a question a Wine group could answer best. |
|
| Back to top |
|
 |
PastorEd General User


Joined: 28 Sep 2004 Posts: 9 Location: the bustling metropolis of Centralia, WA
|
Posted: Sun Sep 23, 2007 3:31 pm Post subject: All Right! |
|
|
Thank you, acknack!
That script brings me MUCH closer to what I'm trying to do. Now I just need to tweak it so that it actually gets to the file... but no more backslashes!
Here's what I have now:
"/home/user/.wine/drive_c/Program Files/Youth Assistant SE/C:/Program does not exist."
So... if we can just get this script to see the correct directory where all the files are kept, we should be golden!
(by the way, I did try installing a couple of MSWin word processors that would be called by wine - and they *do* work, but they don't work well, and it's an awfully bulky work-around... but I had the same idea earlier. Good suggestion, though.) _________________ GBYLBT... PastorEd
Registered Linux user #316504
(God Bless Your Linux Box Today) |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Sun Sep 23, 2007 4:29 pm Post subject: |
|
|
Ok, give this one a try:
| Code: | #!/bin/sh
for i in "$@"
do
# change back- to forward slashes
# remove redundant path elements
x="`echo "$i" | sed -e 's!\\\!/!g' -e 's!/C:/Program Files/YA!!'`"
a="$a \"$x\""
done
eval ooffice $a
|
This is hardwired to that specific directory--it's not smart about fixing the file location, so it's not very flexible but it seems to work for the example you showed.
This one also adds quotes to get around the problem with spaces in the name. |
|
| Back to top |
|
 |
PastorEd General User


Joined: 28 Sep 2004 Posts: 9 Location: the bustling metropolis of Centralia, WA
|
Posted: Thu Oct 04, 2007 1:31 pm Post subject: |
|
|
acknak - thanks so much for your help. I can tell I'm getting closer all the time.
However, it's not there yet. Here's what's happening with your new script:
Writer launches just fine, and then I get a dialog that says:
/C:/Program Files/Youth Assistant SE/Forms/Evt Budget.doc does not exist.
(that is the actual message I'm getting; earlier I had substituted YA for Youth Assistant SE, and desired.doc for Evt Budget.doc)
So, I *think* the problem is somewhere in what's being substituted. I'm not that familiar with the 'sed' command, although I'm getting better, I suppose.
A quick recap:
The files that I want my Linux OO.org Writer to open are found in:
/home/ed/.wine/drive_c/Program\ Files/Youth\ Assistant\ SE/Forms
Each one of the files has at least one space in it's name:
Evt Budget.doc
Fin Budget Cat.doc
V YM Staff Reference.doc
(and so on)
I'm trying to get a Win98 program (Youth Assistant Special Edition) to launch and correctly load the desired file.
Status: the Win98 program can launch Writer - it just isn't loading the desired file, because it can't understand the location on my hard drive.
Thanks again, acknak, for your attempts at help, and anyone else who's tried to help as well. _________________ GBYLBT... PastorEd
Registered Linux user #316504
(God Bless Your Linux Box Today) |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Mon Oct 08, 2007 2:43 pm Post subject: |
|
|
Hi Ed--sorry about the delay; I was just swamped for time to think about what you wrote.
Give this a try:
| Code: | #!/bin/sh
# Convert wine filename arguments like this
# /home/user/.wine/drive_c/Program Files/YA/C:\Program Files\YA\Forms\desired.doc
# to this:
# /home/user/.wine/drive_c/Program Files/YA/Forms/desired.doc
# where "YA" can be any single directory name
for i in "$@"
do
# change back- to forward slashes
# remove redundant path elements
x="`echo "$i"|sed -e 's!\\\!/!g' -e 's!/C:/Program Files/[^/]*/!/!'`"
echo "wine_ooo: '$i'->'$x'" >&2
a="$a '$x'"
done
echo "wine_ooo: final arg list is:($a)" >&2
eval ooffice $a
|
If that still does not work, then try running wine from your command line and see if you get any output in the terminal window from this script. If you do, paste it here and we'll keep after it. |
|
| Back to top |
|
 |
|