Re: Re: hyperlink to pdf files
- To: mathgroup at smc.vnet.net
- Subject: [mg45649] Re: [mg45565] Re: hyperlink to pdf files
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Fri, 16 Jan 2004 19:58:14 -0500 (EST)
- Organization: Universitaet Hannover
- References: <bu0dkd$amu$1@smc.vnet.net> <200401140626.BAA19705@smc.vnet.net> <738C1FC2-481D-11D8-ACEF-000A9582419E@mac.com>
- Sender: owner-wri-mathgroup at wolfram.com
On the question how to create platform independent and environment dependent hyperlinks. Since I have no Linux System runnig Mathematica these hours perhaps this will take you a step further: Cell[TextData[ButtonBox["Relativistische Quantenmechanik", ButtonEvaluator->Automatic, ButtonData:>{ URL[ StringJoin["file:///",ToFileName[{Environment["userprofile"],"Desktop","RelQm01.pdf"}]]], None}, Active->True, ButtonStyle->"Hyperlink"]], "Input"] ToFileName[] without a wrapping List is considered to be an error by the Show Expression translator button. I have added ToFileName[{ path,...,file }] and a third / in "file:///" -- Roland Franzius Christopher Purcell wrote: > Thanks for the reply. You got a lot further than I did, but your > final example is still not platform independent, the > \\ won't work on Unix. The ToFileName function is the one that > translates file names but when it is inserted the URL[ ] fails. Its > probably finger trouble on my end. > > Christopher Purcell > Sensors & Actuators Group > DRDC-Atlantic, 9 Grove St., PO Box 1012, > Dartmouth NS B2Y 3Z7 Canada > Tel 902-426-3100 x389 > Fax 902-426-9654 > On Jan 14, 2004, at 2:26 AM, Roland Franzius wrote: > >> Hi Christopher >> >> These cells after converting them from Show Expression menu all worked >> for me on windows 2000 Mathematica 4.01 >> >> Original pasted by right button context menu URL browser >> >> Cell[TextData[ButtonBox["Relativistische Quantenmechanik", >> ButtonData->{URL["file://C: >> \\apollo\\TeX\\RelQm\\Paper\\RelQm01.pdf"],None}, >> ButtonStyle->"Hyperlink"]],"Input"] >> >> Next change Options: ButtonEvaluator->Automatic and Active->True to >> engage kernel evaluation. We put the file on desktop to test >> environment >> evalaution. >> >> Direct reference working >> >> Cell[TextData[ButtonBox["Relativistische Quantenmechanik", >> ButtonData->{URL[StringJoin["file://D:\\Dokumente und >> Einstellungen\\Administrator\\Desktop\\","RelQm01.pdf"]], None}, >> ButtonStyle->"Hyperlink",Active->True,ButtonEvaluator->Automatic]], >> "Input"] >> >> >> Invoke a StringJoin to prepare the URL >> >> Cell[TextData[ButtonBox["Relativistische Quantenmechanik", >> ButtonEvaluator->Automatic, >> ButtonData:>{ >> URL[ >> StringJoin[ "file://","D:\\Dokumente und >> Einstellungen\\Administrator\\Desktop\\", "RelQm01.pdf"]], None}, >> Active->True, >> ButtonStyle->"Hyperlink"]], "Input"] >> >> At last we invoke Environment[ ] to get the real time language >> independent path >> >> >> Cell[TextData[ButtonBox["Relativistische Quantenmechanik", >> ButtonEvaluator->Automatic, >> ButtonData:>{ >> URL[ >> StringJoin[ "file://", Environment["userprofile"],"\\Desktop", >> "\\RelQm01.pdf"]], None}, >> Active->True, >> ButtonStyle->"Hyperlink"]], "Input"] >> >> Hope it helps >> >> Roland >> >> -- >> >> Roland Franzius >> >> >> >> >> Christopher Purcell wrote: >> >>> I would like to insert hyperlinks to pdf files in notebooks in a >>> platform independent way. >>> >>> I can create a cell that looks like this: >>> >>> Cell[TextData[ButtonBox["Examples Manual", >>> ButtonData:>{ >>> URL[ >>> "file:///Library/Mathematica/Applications/MyPackage/Documentation/ >>> English/References/examples.pdf"], None}, >>> ButtonStyle->"Hyperlink"]], "Input"] >>> >>> that works great on MacOSX to hyperlink to the file examples.pdf. >>> I am >>> sure I can do something similar on Windows, provided I use Windows >>> style paths. >>> >>> But to have this work in a platform-independent way, >>> I would like to make the argument of URL[ ] to be something like: >>> >>> "file:/ >>> /"<>ToFileName[{$AddOnsDirectory,"MyPackage","Documentation","English" >>> ," >>> References"},"examples.pdf"] >>> >>> But this doesn't work. Putting Evaluate around it does not help. >>> URL or >>> ButtonData reject everything except the explicit text string. Any >>> other >>> ideas? >>> >>> >>> >>> >>> Christopher Purcell >>> Sensors & Actuators Group >>> DRDC-Atlantic, 9 Grove St., PO Box 1012, >>> Dartmouth NS B2Y 3Z7 Canada >>> Tel 902-426-3100 x389 >>> Fax 902-426-9654 >>> >> > >
- References:
- Re: hyperlink to pdf files
- From: Roland Franzius <roland.franzius@uos.de>
- Re: hyperlink to pdf files