Ric,
from wd documentation,
winexec text [style]; Execute program. style is same as for pshow.
wd ' winexec  "write.exe  text.wri"  sw_showmaximized;'

so that winexec expect at most _2_ parameters, the first parameter is the text to be passed to shell for execution. If the text contains space, it should be delimited with " or DEL (EAV if J504). In your case the text itself contains " so that you should use DEL as delimiter, wd 'winexec ',DEL,'"C:\Program Files\Microsoft Office\OFFICE11\excel.exe" "C:\Documents and Settings\bill\My Documents\bill.xls"',DEL,'sw_hide'
or if you do not need the style to hide the excel,
wd 'winexec *"C:\Program Files\Microsoft Office\OFFICE11\excel.exe" "C:\Documents and Settings\bill\My Documents\bill.xls"'

in window, extension .xls is associated with ms excel or OOo, so you may write
wd 'winexec ',DEL,'"cmd /C "C:\Documents and Settings\bill\My Documents\bill.xls"',DEL,'sw_hide'

this hide the cmd prompt window but not excel window.

In Linux, I guess the same pattern applies, albeit the shell is not cmd.

Sherlock, Ric wrote:
I want to open a file with the application associated with that file
extension.
E.g. I have an Excel file (*.xls) and I want to open it in Excel.

If the file name doesn't contain any spaces then the following works on
Windows.

wd 'winexec "cmd /C ',filename,'" sw_hide'

How can I accomplish something similar if the file name contains spaces?

Is it possible to come up with a platform agnostic version?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm



--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to