Re: Hyperlinks
- To: mathgroup at smc.vnet.net
- Subject: [mg98426] Re: [mg98371] Hyperlinks
- From: John Fultz <jfultz at wolfram.com>
- Date: Thu, 9 Apr 2009 05:57:26 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
On Wed, 8 Apr 2009 05:02:13 -0400 (EDT), A. B. wrote:
> Dear Mathematica experts,
>
> Hyperlinks in notebooks can only link to tagged cells in the notebook or
> to
> URLs on the web, or so it seems.
> I would find it useful to be able to link to an external file (not a
> notebook nor a text file) and having the file opened by the default
> external
> application that handles the given file type.
> Would it be possible to implement this, maybe programmatically (functions
> sending commands to the operating system ? Applescript ?) ?
>
> Many thanks.
> A. Berkani
A file: URL passed to the Hyperlink[] command should work fine if you're okay
with specifying an absolute path. Otherwise, you could pass a SystemOpen
command (which is the programmatic way to do this) to a Button styled to look
like a hyperlink. For example,
Button["abcd",
SystemOpen[FileNameJoin[{NotebookDirectory[], "xxx.doc"}]],
BaseStyle -> "Hyperlink", Appearance -> None]
where "xxx.doc" would be relative to the path of the notebook itself.
Sincerely,
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.