MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Opening a foreign file from Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78932] Re: Opening a foreign file from Mathematica
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Fri, 13 Jul 2007 06:00:45 -0400 (EDT)
  • References: <f6vnng$qj7$1@smc.vnet.net><f74rur$893$1@smc.vnet.net>

Hi Tom,

After a couple of sips of coffee I remembered what the issue was here--
having encountered and solved it a long while ago within
http://scientificarts.com/worklife ....  This is that, on a Unix
system (including mac OS X, of course), one must "escape" any spaces
in a file's full path.  So, Including the following Which statement
(based on the code for OpenFileOrDirectory within in A
WorkLifeFrameWork) will fix things up so that the file paths can
contain space characters:

Which[

StringMatchQ[$System, "Mac OS X*"|"Linux"|"Unix"],
fileLink=StringReplace[fileLink," "->"%20"],

StringMatchQ[$System,"Microsoft Windows*"],
fileName=fileLink,

True,
Throw[$Failed]

]


The Throw assumes the enclosing Catch that was in the code in my
original posting.



Best regards,

David



On Jul 12, 5:23 am, "tom_t... at telus.net" <tom_t... at telus.net> wrote:
> Hello!   I read these posts about linking to "foreign" files with
> great interest.  I have wondered about hyperlinking to non Mathematica files
> for some time,  I wish I had known about this sooner.
>
> On my Mac,  I created a Mathematica file, a toplevel folder, and
> inside it, a Data folder to hold the files I wanted to link to.  for
> the sample below, that file was called test.gsp  (A Geometer's
> Sketchpad file)
>
> This worked perfectly,  I was thankful for David's response.
> However,  I did find that if the "toplevel" folder name had spaces, it
> didn't work.   I could make it very long, no problem, but as soon as
> the name had spaces, it didn't work.   Is that the expected
> behavior?
>
> I appreciate this group and the input provided.
>
> Sincerely,  Tom De Vries
>
> dir = DirectoryName[ToFileName["FileName" /. NotebookInformation[
>              ]]];
>
> subdir = "Data";
>
> filepath = ToFileName[{dir, subdir}, "test.gsp"];
>
> fileLink = StringJoin["file://", filepath];
>
> NotebookLocate[{URL[fileLink], None}];




  • Prev by Date: Re: Palette to write out Global Names to a Selected NB
  • Next by Date: Re: Labeling individual plot points using PlotMarkers
  • Previous by thread: Re: Opening a foreign file from Mathematica
  • Next by thread: Re: Opening a foreign file from Mathematica