Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Non-Mathematica formats, e.g. .doc or .txt files, are directly shown in a new notebook when I click on a hyperlink pointing at these objects. But I would rather have (for example) .doc files opened using Microsoft Word. How can one create a hyperlink that opens a file in its associated application, rather than in Mathematica?

share|improve this question
6  
Please check this Q/A .. link to a generic file and the docs page SystemOpen –  kguler Jan 16 '13 at 9:36
add comment

2 Answers 2

You can open with Word like this:

file = "http://backend.ewock.com/ewockhome/images/word8.doc";

Run["start winword \"" <> file <> "\""];

And you could make a hyperlink like this:

Row[{Style["Demo\[ThinSpace]", FontFamily -> "Arial"],
 Button[Style["test doc", Blue, FontFamily -> "Arial"],
  Run["start winword \"" <> file <> "\""], Appearance -> "Frameless"],
 Style["\[ThinSpace]hyperlink", FontFamily -> "Arial"]}]

enter image description here

share|improve this answer
add comment

Slightly modified version of this answer to a related Q/A.

Row[{"Buttons that look like hyperlinks to open files \n ", 
Sequence @@ (Button[
   Dynamic@Style[#[[1]], 14, 
     If[CurrentValue["MouseOver"], "HyperlinkActive", 
      "Hyperlink"]], 
   SystemOpen[$InstallationDirectory <> 
     "\\Documentation\\English\\System\\ExampleData\\" <> #[[2]]],
    Appearance -> None] & /@
 {{"Spikey   ", "spikey2.png"},
  {"Calendar   ", "calendar.ics"},
  {"A pdf file   ", "mathematica.pdf"}}),
  " \nusing ", Hyperlink["SystemOpen", "paclet:ref/SystemOpen"], "."}]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.