You're so close. The vanilla method is like

   launch "foo.doc" with "Microsoft Word"

The problem is actually resolving where (and IF) the Word application resides on the user's box. In the Windows environment (and it holds true all the way up to Win200 Advanced Server), it's by default going to be in the path

    C:\Program Files\Microsoft Office\Office\Windword.exe

but you can make sure by reading the registry key below, which should tell the location of the app even across the network. Use MC's queryRegistry() function:

put queryRegistry("HKEY_CLASSES_ROOT\WordDocument\protocol\StdFileEditing\server\") into wordAppPath

which returns a physical path like "C:\PROGRA~1\MICROS~1\Office\WINWORD.EXE"

One extra way to find out IF the user has Word installed is by means of

put queryRegistry("HKEY_CLASSES_ROOT\Word.Application\") into wordAppFormalName

which returns "Microsoft Word Application" if installed. Failing all this, you will get "not opened" in the result. In SuperCard there was a nice answer file dialog box that asked, e.g., "Where is Microsoft Word?" but you can trap that result and do the same. Here's a simple handler that can do that. Just invoke it with something like "editFile myFilePath, myApp"

on editFile filePath, appName
  if appName = "" then put "Microsoft Word" into appName
  launch filePath with appName
 
  if the result = "not opened" then
    # ask user to locate the application:
    if platform() = "Win32" then put "*EXE" into appType
    else put "APPL" into appType # shd support UNIX, but there, many types can open files
   
    answer file "Where is " & appName & "?" of type appType
    if it = "" then exit to top
    put it into appName
  end if
 
  # and try again:
  launch filePath with appName
 
  # still no success?
  if the result = "Not opened" then
    answer "Sorry, the selected application cannot open this kind of file."
    exit to top
  en! d if
end editFile

  Alvin Miller <[EMAIL PROTECTED]> wrote:

Hi all,

I am sure that I am missing something in the documentation. What I am
trying to do, is to launch a word document from my metacard executable.

I haven't found anything that works yet. Any help would be greatly
appreciated.

Thanks,

Alvin

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.


Francisco J. Ricardo, Ph.D.



Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. Yahoo! by Phone.

Reply via email to